From 1bfc6d5d8194bc6e527cff5d187920f27dfbc041 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 24 Apr 2016 00:53:13 +0200 Subject: [PATCH] Fix "unused but set variable" warnings from GCC --- Sources/Engine/Base/Anim.cpp | 4 ++-- Sources/Engine/Graphics/Gfx_OpenGL.cpp | 4 ++-- Sources/Engine/Graphics/Graphics.cpp | 4 ++-- Sources/Engine/Models/RenderModel_View.cpp | 4 ++-- Sources/Engine/Network/ClientInterface.cpp | 8 ++++---- Sources/Engine/Network/Diff.cpp | 4 ++-- Sources/Engine/Network/SessionState.cpp | 4 ++-- Sources/Engine/Ska/Mesh.cpp | 6 +++--- Sources/Engine/Templates/BSP.cpp | 2 ++ Sources/Engine/Terrain/Terrain.cpp | 6 ++++-- Sources/Engine/World/WorldCSG.cpp | 3 +++ Sources/EntitiesMP/Common/Particles.cpp | 6 +++--- Sources/EntitiesMP/CreditsHolder.es | 4 ++-- Sources/EntitiesMP/Elemental.es | 18 +++++++++--------- Sources/EntitiesMP/Fish.es | 2 +- Sources/EntitiesMP/Item.es | 8 ++++---- Sources/EntitiesMP/ModelHolder2.es | 2 +- Sources/EntitiesMP/PlayerAnimator.es | 2 +- Sources/EntitiesMP/PlayerWeapons.es | 2 +- Sources/EntitiesMP/PyramidSpaceShip.es | 2 +- Sources/EntitiesMP/SpawnerProjectile.es | 3 ++- Sources/GameMP/Controls.cpp | 4 ++-- Sources/SeriousSam/Menu.cpp | 1 + Sources/Shaders/Common.cpp | 4 ++-- 24 files changed, 58 insertions(+), 49 deletions(-) diff --git a/Sources/Engine/Base/Anim.cpp b/Sources/Engine/Base/Anim.cpp index d686832..e491e12 100644 --- a/Sources/Engine/Base/Anim.cpp +++ b/Sources/Engine/Base/Anim.cpp @@ -296,13 +296,13 @@ void CAnimData::LoadFromScript_t( CTStream *File, CListHead *pFrameFileList) // char ld_line[ 128]; CTmpListHead TempAnimationList; SLONG lc; - BOOL ret_val; + //BOOL ret_val; //ASSERT( ad_Anims == NULL); // clears possible animations CAnimData::Clear(); - ret_val = TRUE; + //ret_val = TRUE; FOREVER { // Repeat reading of one line of script file until it is not empty or comment diff --git a/Sources/Engine/Graphics/Gfx_OpenGL.cpp b/Sources/Engine/Graphics/Gfx_OpenGL.cpp index e0696e4..dd549d9 100644 --- a/Sources/Engine/Graphics/Gfx_OpenGL.cpp +++ b/Sources/Engine/Graphics/Gfx_OpenGL.cpp @@ -505,9 +505,9 @@ extern void SetTBufferEffect( BOOL bEnable) if( ogl_iTBufferEffect==0 || _pGfx->go_ctSampleBuffers<2 || !bEnable) pglDisable( GL_MULTISAMPLE_3DFX); else { pglEnable( GL_MULTISAMPLE_3DFX); - UINT uiMask = 0xFFFFFFFF; + //UINT uiMask = 0xFFFFFFFF; // set one buffer in case of motion-blur - if( ogl_iTBufferEffect==2) uiMask = (1UL) << _pGfx->go_iCurrentWriteBuffer; + //if( ogl_iTBufferEffect==2) uiMask = (1UL) << _pGfx->go_iCurrentWriteBuffer; //pglTBufferMask3DFX(uiMask); } } diff --git a/Sources/Engine/Graphics/Graphics.cpp b/Sources/Engine/Graphics/Graphics.cpp index b1d6f13..4f3dc06 100644 --- a/Sources/Engine/Graphics/Graphics.cpp +++ b/Sources/Engine/Graphics/Graphics.cpp @@ -548,7 +548,7 @@ void ColorizeMipmaps( INDEX i1stMipmapToColorize, ULONG *pulMipmaps, PIX pixWidt { // prepare ... ULONG *pulSrcMipmap = pulMipmaps + GetMipmapOffset( i1stMipmapToColorize, pixWidth, pixHeight); - ULONG *pulDstMipmap; + //ULONG *pulDstMipmap; PIX pixCurrWidth = pixWidth >>i1stMipmapToColorize; PIX pixCurrHeight = pixHeight>>i1stMipmapToColorize; PIX pixMipSize; @@ -561,7 +561,7 @@ void ColorizeMipmaps( INDEX i1stMipmapToColorize, ULONG *pulMipmaps, PIX pixWidt while( pixCurrWidth>1 && pixCurrHeight>1) { // prepare current mip-level pixMipSize = pixCurrWidth*pixCurrHeight; - pulDstMipmap = pulSrcMipmap + pixMipSize; + //pulDstMipmap = pulSrcMipmap + pixMipSize; // mask mipmap const ULONG ulColorMask = ByteSwap( _acolMips[iTableOfs] | 0x3F3F3FFF); for( INDEX iPix=0; iPixpa_ulSequence,FALSE); delete ppaPacket; - bSomethingDone = TRUE; + //bSomethingDone = TRUE; // if the packet is reliable } else if (ppaPacket->pa_ubReliable & UDP_PACKET_RELIABLE) { @@ -547,7 +547,7 @@ BOOL CClientInterface::UpdateInputBuffers(void) // packet separately, instead of grouping them together BOOL CClientInterface::UpdateInputBuffersBroadcast(void) { - BOOL bSomethingDone; + //BOOL bSomethingDone; CTimerValue tvNow; // if there are packets in the input buffer, process them @@ -585,7 +585,7 @@ BOOL CClientInterface::UpdateInputBuffersBroadcast(void) } ci_pbInputBuffer.RemovePacket(ppaPacket->pa_ulSequence,FALSE); - bSomethingDone = TRUE; + //bSomethingDone = TRUE; delete ppaPacket; // if the packet is reliable } else if (ppaPacket->pa_ubReliable & UDP_PACKET_RELIABLE) { diff --git a/Sources/Engine/Network/Diff.cpp b/Sources/Engine/Network/Diff.cpp index 11d3541..cd1c084 100644 --- a/Sources/Engine/Network/Diff.cpp +++ b/Sources/Engine/Network/Diff.cpp @@ -224,14 +224,14 @@ void UnDiff_t(void) //UBYTE *pubOld = _pubOld; UBYTE *pubNew = _pubNew; SLONG slSizeOldStream = 0; - SLONG slSizeOutStream = 0; + //SLONG slSizeOutStream = 0; // get header with size of files if (*(SLONG*)pubNew!=DIFF) { ThrowF_t(TRANS("Not a DIFF stream!")); } pubNew+=sizeof(SLONG); slSizeOldStream = *(SLONG*)pubNew; pubNew+=sizeof(SLONG); - slSizeOutStream = *(SLONG*)pubNew; pubNew+=sizeof(SLONG); + /* slSizeOutStream = *(SLONG*)pubNew; */ pubNew+=sizeof(SLONG); ULONG ulCRC = *(ULONG*)pubNew; pubNew+=sizeof(ULONG); CRC_Start(_ulCRC); diff --git a/Sources/Engine/Network/SessionState.cpp b/Sources/Engine/Network/SessionState.cpp index 4475483..cdc3b9e 100644 --- a/Sources/Engine/Network/SessionState.cpp +++ b/Sources/Engine/Network/SessionState.cpp @@ -695,7 +695,7 @@ void CSessionState::HandleMovers(void) void CSessionState::HandleTimers(TIME tmCurrentTick) { #define TIME_EPSILON 0.0001f - IFDEBUG(TIME tmLast = 0.0f); + //IFDEBUG(TIME tmLast = 0.0f); _pfPhysicsProfile.StartTimer(CPhysicsProfile::PTI_HANDLETIMERS); // repeat @@ -729,7 +729,7 @@ void CSessionState::HandleTimers(TIME tmCurrentTick) // check that timers are propertly handled ASSERT(penTimer->en_timeTimer>tmCurrentTick-_pTimer->TickQuantum-TIME_EPSILON); //ASSERT(penTimer->en_timeTimer>=tmLast); - IFDEBUG(tmLast=penTimer->en_timeTimer); + //IFDEBUG(tmLast=penTimer->en_timeTimer); // remove the timer from the list penTimer->en_timeTimer = THINKTIME_NEVER; diff --git a/Sources/Engine/Ska/Mesh.cpp b/Sources/Engine/Ska/Mesh.cpp index 769b4fe..b5fe256 100644 --- a/Sources/Engine/Ska/Mesh.cpp +++ b/Sources/Engine/Ska/Mesh.cpp @@ -789,7 +789,7 @@ void CMesh::Read_t(CTStream *istrFile) // read float count (*istrFile)>>ctfl; - CShader *pshMeshShader = NULL; + //CShader *pshMeshShader = NULL; ShaderParams *pshpShaderParams = NULL; CShader shDummyShader; // dummy shader if shader is not found ShaderParams shpDummyShaderParams;// dummy shader params if shader is not found @@ -799,12 +799,12 @@ void CMesh::Read_t(CTStream *istrFile) // try to load shader try{ msrf.msrf_pShader = _pShaderStock->Obtain_t(strShaderName); - pshMeshShader = msrf.msrf_pShader; + //pshMeshShader = msrf.msrf_pShader; pshpShaderParams = &msrf.msrf_ShadingParams; } catch(char *strErr) { CPrintF("%s\n",strErr); msrf.msrf_pShader = NULL; - pshMeshShader = &shDummyShader; + //pshMeshShader = &shDummyShader; pshpShaderParams = &shpDummyShaderParams; } diff --git a/Sources/Engine/Templates/BSP.cpp b/Sources/Engine/Templates/BSP.cpp index 78b26ec..32dce0e 100644 --- a/Sources/Engine/Templates/BSP.cpp +++ b/Sources/Engine/Templates/BSP.cpp @@ -186,6 +186,8 @@ void BSPVertexContainer::Sort(void) template void BSPVertexContainer::ElliminatePairedVertices(void) { + // FIXME: DG: am I missing something or is this function not actually changing anything? + // if there are no vertices, or the container is not line if (bvc_aVertices.Count()==0 || IsPlannar()) { // do not attempt to sort diff --git a/Sources/Engine/Terrain/Terrain.cpp b/Sources/Engine/Terrain/Terrain.cpp index 4789c85..9af3da6 100644 --- a/Sources/Engine/Terrain/Terrain.cpp +++ b/Sources/Engine/Terrain/Terrain.cpp @@ -202,13 +202,14 @@ void CTerrain::CreateEmptyTerrain_t(PIX pixWidth,PIX pixHeight) void CTerrain::ImportHeightMap_t(CTFileName fnHeightMap, BOOL bUse16b/*=TRUE*/) { _ptrTerrain = this; - BOOL bResizeTerrain = FALSE; + //BOOL bResizeTerrain = FALSE; // Load targa file CImageInfo iiHeightMap; iiHeightMap.LoadAnyGfxFormat_t(fnHeightMap); - // if new width and height are same + // if new width and height are same + /* unused if(tr_pixHeightMapWidth==iiHeightMap.ii_Width && tr_pixHeightMapHeight==iiHeightMap.ii_Height) { // Clear terrain data without removing layers bResizeTerrain = FALSE; @@ -217,6 +218,7 @@ void CTerrain::ImportHeightMap_t(CTFileName fnHeightMap, BOOL bUse16b/*=TRUE*/) bResizeTerrain = TRUE; } bResizeTerrain = TRUE; + */ FLOAT fLogWidht = Log2(iiHeightMap.ii_Width-1); FLOAT fLogHeight = Log2(iiHeightMap.ii_Height-1); diff --git a/Sources/Engine/World/WorldCSG.cpp b/Sources/Engine/World/WorldCSG.cpp index 6db1a7f..f68e55c 100644 --- a/Sources/Engine/World/WorldCSG.cpp +++ b/Sources/Engine/World/WorldCSG.cpp @@ -1004,6 +1004,9 @@ void CWorld::DeleteSectors(CBrushSectorSelection &selbscSectorsToDelete, BOOL bC void CheckOnePolygon(CBrushSector &bsc, CBrushPolygon &bpo) { + // NOTE: This function has no side effects, but I think "Check" means + // "try to access stuff and make sure it doesn't segfault", so keep it + // like it is even if the compiler complains about unused values? CBrushPlane *pbplPlane=bpo.bpo_pbplPlane; INDEX ctEdges=bpo.bpo_abpePolygonEdges.Count(); INDEX ctVertices=bpo.bpo_apbvxTriangleVertices.Count(); diff --git a/Sources/EntitiesMP/Common/Particles.cpp b/Sources/EntitiesMP/Common/Particles.cpp index 8651db7..c369d05 100755 --- a/Sources/EntitiesMP/Common/Particles.cpp +++ b/Sources/EntitiesMP/Common/Particles.cpp @@ -1035,9 +1035,9 @@ void Particles_BeastProjectileTrail( CEntity *pen, FLOAT fSize, FLOAT fHeight, I fT *= 1/BEAST_PROJECTILE_TOTAL_TIME; // get fraction part fT = fT-int(fT); - FLOAT fFade; - if (fT>(1.0f-BEAST_PROJECTILE_FADE_OUT)) fFade=(1-fT)*(1/BEAST_PROJECTILE_FADE_OUT); - else fFade=1.0f; + //FLOAT fFade; + //if (fT>(1.0f-BEAST_PROJECTILE_FADE_OUT)) fFade=(1-fT)*(1/BEAST_PROJECTILE_FADE_OUT); + //else fFade=1.0f; #define GET_POS( time) vCenter + \ vX*(afStarsPositions[iStar][0]*time*fSize*1.5) +\ diff --git a/Sources/EntitiesMP/CreditsHolder.es b/Sources/EntitiesMP/CreditsHolder.es index 019d4d2..86a36ac 100644 --- a/Sources/EntitiesMP/CreditsHolder.es +++ b/Sources/EntitiesMP/CreditsHolder.es @@ -198,7 +198,7 @@ functions: return 1; } - PIX pixW = 0; + //PIX pixW = 0; PIX pixH = 0; //FLOAT fResolutionScaling; CTString strEmpty; @@ -209,7 +209,7 @@ functions: pdp->Unlock(); pdpCurr->Lock(); - pixW = pdpCurr->GetWidth(); + //pixW = pdpCurr->GetWidth(); pixH = pdpCurr->GetHeight(); FLOAT fResFactor = pixH/480.0f; diff --git a/Sources/EntitiesMP/Elemental.es b/Sources/EntitiesMP/Elemental.es index df30d95..1c65808 100644 --- a/Sources/EntitiesMP/Elemental.es +++ b/Sources/EntitiesMP/Elemental.es @@ -873,20 +873,20 @@ functions: GetBoundingBox(box); FLOAT fEntitySize = box.Size().MaxNorm()/2; - INDEX iCount = 1; + FLOAT3D vNormalizedDamage = m_vDamage-m_vDamage*(m_fBlowUpAmount/m_vDamage.Length()); + vNormalizedDamage /= Sqrt(vNormalizedDamage.Length()); + vNormalizedDamage *= 1.75f; +/* + FLOAT3D vBodySpeed = en_vCurrentTranslationAbsolute-en_vGravityDir*(en_vGravityDir%en_vCurrentTranslationAbsolute); + + // spawn debris + + INDEX iCount = 1; switch (m_EecChar) { case ELC_SMALL: iCount = 3; break; case ELC_BIG: iCount = 5; break; case ELC_LARGE: iCount = 7; break; } - - FLOAT3D vNormalizedDamage = m_vDamage-m_vDamage*(m_fBlowUpAmount/m_vDamage.Length()); - vNormalizedDamage /= Sqrt(vNormalizedDamage.Length()); - vNormalizedDamage *= 1.75f; - FLOAT3D vBodySpeed = en_vCurrentTranslationAbsolute-en_vGravityDir*(en_vGravityDir%en_vCurrentTranslationAbsolute); - - // spawn debris -/* switch (m_EetType) { case ELT_ICE: { Debris_Begin(EIBT_ICE, DPT_NONE, BET_NONE, fEntitySize, vNormalizedDamage, vBodySpeed, 1.0f, 0.0f); diff --git a/Sources/EntitiesMP/Fish.es b/Sources/EntitiesMP/Fish.es index 8ab8a6e..9d3e60a 100755 --- a/Sources/EntitiesMP/Fish.es +++ b/Sources/EntitiesMP/Fish.es @@ -140,7 +140,7 @@ functions: // render one lightning toward enemy FLOAT3D vSource = GetPlacement().pl_PositionVector; FLOAT3D vTarget = m_penEnemy->GetPlacement().pl_PositionVector; - FLOAT3D vDirection = (vTarget-vSource).Normalize(); + //FLOAT3D vDirection = (vTarget-vSource).Normalize(); Particles_Ghostbuster(vSource, vTarget, 32, 1.0f); // random lightnings arround diff --git a/Sources/EntitiesMP/Item.es b/Sources/EntitiesMP/Item.es index e07f23b..284cd97 100644 --- a/Sources/EntitiesMP/Item.es +++ b/Sources/EntitiesMP/Item.es @@ -73,7 +73,7 @@ functions: return; } - BOOL bFlare = TRUE; + //BOOL bFlare = TRUE; // if current player has already picked this item if (_ulPlayerRenderingMask&m_ulPickedMask) { // if picked items are not rendered @@ -83,11 +83,11 @@ functions: fMipFactor = UpperLimit(0.0f); } // if picked item particles are not rendered - extern INDEX plr_bRenderPickedParticles; + /*extern INDEX plr_bRenderPickedParticles; if (!plr_bRenderPickedParticles) { // kill flare - bFlare = FALSE; - } + bFlare = FALSE; // DG: bFlare is otherwise unused! + }*/ } // implement flare on/off ? diff --git a/Sources/EntitiesMP/ModelHolder2.es b/Sources/EntitiesMP/ModelHolder2.es index 2c51ab4..21df4ec 100644 --- a/Sources/EntitiesMP/ModelHolder2.es +++ b/Sources/EntitiesMP/ModelHolder2.es @@ -217,7 +217,7 @@ functions: } else { vDirectionFixed = FLOAT3D(0,1,0); } - FLOAT3D vDamageOld = m_vDamage; + //FLOAT3D vDamageOld = m_vDamage; m_vDamage += vDirectionFixed*fKickDamage; // NOTE: we don't receive damage here, but handle death differently diff --git a/Sources/EntitiesMP/PlayerAnimator.es b/Sources/EntitiesMP/PlayerAnimator.es index 13c65df..6aef7ae 100644 --- a/Sources/EntitiesMP/PlayerAnimator.es +++ b/Sources/EntitiesMP/PlayerAnimator.es @@ -1054,7 +1054,7 @@ functions: FLOAT3D vDesiredTranslation = pl.en_vDesiredTranslationRelative; FLOAT3D vCurrentTranslation = pl.en_vCurrentTranslationAbsolute * !pl.en_mRotation; ANGLE3D aDesiredRotation = pl.en_aDesiredRotationRelative; - ANGLE3D aCurrentRotation = pl.en_aCurrentRotationAbsolute; + //ANGLE3D aCurrentRotation = pl.en_aCurrentRotationAbsolute; // if player is moving if (vDesiredTranslation.ManhattanNorm()>0.01f diff --git a/Sources/EntitiesMP/PlayerWeapons.es b/Sources/EntitiesMP/PlayerWeapons.es index 1b2176a..d98a9de 100755 --- a/Sources/EntitiesMP/PlayerWeapons.es +++ b/Sources/EntitiesMP/PlayerWeapons.es @@ -1988,7 +1988,7 @@ functions: FLOATmatrix3D m; MakeRotationMatrixFast(m, plKnife.pl_OrientationAngle); FLOAT3D vRight = m.GetColumn(1)*fWide; - FLOAT3D vUp = m.GetColumn(2)*fWide; + //FLOAT3D vUp = m.GetColumn(2)*fWide; FLOAT3D vFront = -m.GetColumn(3)*fRange; FLOAT3D vDest[3]; diff --git a/Sources/EntitiesMP/PyramidSpaceShip.es b/Sources/EntitiesMP/PyramidSpaceShip.es index 42c579a..ec62ae4 100644 --- a/Sources/EntitiesMP/PyramidSpaceShip.es +++ b/Sources/EntitiesMP/PyramidSpaceShip.es @@ -486,7 +486,7 @@ functions: void SpawnBeamMachineMainFlare(void) { // spawn main flare - CPlacement3D plSpaceShip = GetPlacement(); + //CPlacement3D plSpaceShip = GetPlacement(); CPlacement3D plFlare = CPlacement3D( FLOAT3D(0, BM_MASTER_Y+BM_FLARE_DY, 0), ANGLE3D(0,0,0)); plFlare.RelativeToAbsolute(GetPlacement()); CEntity *penFlare = CreateEntity( plFlare, CLASS_EFFECTOR); diff --git a/Sources/EntitiesMP/SpawnerProjectile.es b/Sources/EntitiesMP/SpawnerProjectile.es index f654581..a3048cb 100644 --- a/Sources/EntitiesMP/SpawnerProjectile.es +++ b/Sources/EntitiesMP/SpawnerProjectile.es @@ -83,10 +83,11 @@ functions: pen->Initialize(); // adjust circle radii to account for enemy size + /* unused FLOAT fEntityR = 0; if (pen->en_pciCollisionInfo!=NULL) { fEntityR = pen->en_pciCollisionInfo->GetMaxFloorRadius(); - } + } */ // teleport back pen->Teleport(GetPlacement(), FALSE); diff --git a/Sources/GameMP/Controls.cpp b/Sources/GameMP/Controls.cpp index fa0df01..9147ff0 100644 --- a/Sources/GameMP/Controls.cpp +++ b/Sources/GameMP/Controls.cpp @@ -222,8 +222,8 @@ void CControls::Load_t( CTFileName fnFile) achrIfInverted[ 0] = 0; char achrIfRelative[ 1024]; achrIfRelative[ 0] = 0; - char achrIfSmooth[ 1024]; - achrIfSmooth[ 0] = 0; + //char achrIfSmooth[ 1024]; + //achrIfSmooth[ 0] = 0; achrActionName[ 0] = 0; FLOAT fSensitivity = 50; FLOAT fDeadZone = 0; diff --git a/Sources/SeriousSam/Menu.cpp b/Sources/SeriousSam/Menu.cpp index ee546cb..a2f992d 100644 --- a/Sources/SeriousSam/Menu.cpp +++ b/Sources/SeriousSam/Menu.cpp @@ -4077,6 +4077,7 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer) mgPlayerModel.mg_strTip = TRANS("cannot change model for single-player game"); mgPlayerModel.mg_bEnabled = FALSE; } + (void)bSet; // ignore gender flags, if any strName.RemovePrefix("#female#"); strName.RemovePrefix("#male#"); diff --git a/Sources/Shaders/Common.cpp b/Sources/Shaders/Common.cpp index 83d660d..10d7a7a 100644 --- a/Sources/Shaders/Common.cpp +++ b/Sources/Shaders/Common.cpp @@ -100,9 +100,9 @@ void DoSpecularLayer(INDEX iSpeculaTexture,INDEX iSpecularColor) void DoReflectionLayer(INDEX iReflectionTexture,INDEX iReflectionColor,BOOL bFullBright) { - GFXVertex4 *paVertices = NULL; + //GFXVertex4 *paVertices = NULL; GFXNormal *paNormals = NULL; - paVertices = shaGetVertexArray(); + //paVertices = shaGetVertexArray(); paNormals = shaGetNormalArray(); INDEX ctVertices = shaGetVertexCount(); GFXTexCoord *ptcUVMap = shaGetNewTexCoordArray();