From dbe524f0b2697d6af060a944137c7da326a61402 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sat, 23 Apr 2016 20:25:08 +0200 Subject: [PATCH] Fix more warnings, mostly about logical op parenthesis (TSE only) except for EntitiesMP/Fish.es which I'm not sure about, and in Computer.cpp the weird "if (_iActiveMessage < _acmMessages.Count()==0)" construct whichs intention I didn't fully grasp, either. --- Sources/CMakeLists.txt | 11 +++++----- Sources/Engine/Base/Lists.cpp | 6 ++--- Sources/Engine/Classes/MovableEntity.es | 22 +++++++++---------- Sources/Engine/Entities/Entity.cpp | 12 +++++----- Sources/Engine/Math/Object3D.cpp | 2 +- Sources/Engine/Math/Projection_Isometric.cpp | 4 +++- Sources/Engine/Math/Projection_Parallel.cpp | 2 +- .../Engine/Math/Projection_Perspective.cpp | 2 +- Sources/Engine/Models/RenderModel.cpp | 4 ++-- Sources/Engine/Network/Server.cpp | 4 ++-- Sources/Engine/Rendering/RenCache.cpp | 4 ++-- Sources/Engine/Rendering/Render.cpp | 6 ++--- Sources/Engine/Rendering/RenderAdding.cpp | 2 +- Sources/Engine/Sound/SoundLibrary.cpp | 2 +- Sources/Engine/World/World.cpp | 6 ++--- Sources/EntitiesMP/Common/HUD.cpp | 2 +- Sources/EntitiesMP/Debris.es | 2 +- Sources/EntitiesMP/Dragonman.es | 4 ++-- Sources/EntitiesMP/Effector.es | 8 ++++--- Sources/EntitiesMP/Elemental.es | 2 +- Sources/EntitiesMP/Fish.es | 3 +++ Sources/EntitiesMP/Player.es | 9 ++++---- Sources/EntitiesMP/PlayerWeapons.es | 4 ++-- Sources/GameMP/Computer.cpp | 8 +++---- Sources/GameMP/Game.cpp | 8 +++---- Sources/GameMP/Game.h | 2 +- Sources/GameMP/WEDInterface.cpp | 2 +- Sources/SeriousSam/SeriousSam.cpp | 7 +++--- 28 files changed, 79 insertions(+), 71 deletions(-) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index e40679a..e0c8929 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -110,6 +110,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations") # TODO fix these warnings + # !!! FIXME: turn a bunch of these off, this is just for now. I hope. --ryan. add_compile_options(-Wno-sign-compare) add_compile_options(-Wno-switch) add_compile_options(-Wno-char-subscripts) @@ -117,16 +118,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") 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) + add_compile_options(-Wno-overloaded-virtual) MESSAGE(WARNING, "re-enable some of the warnings some day!") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - # !!! FIXME: turn a bunch of these off, this is just for now. I hope. --ryan. - add_compile_options(-Wno-tautological-undefined-compare) + add_compile_options(-Wno-tautological-undefined-compare) # don't complain about if(this!=NULL) add_compile_options(-Wno-c++11-compat-deprecated-writable-strings) - add_compile_options(-Wno-logical-op-parentheses) # FIXME: this too should be re-enabled - else() - add_compile_options(-Wno-unused-but-set-variable) # my clang doesn't know this + else() # most probably GCC + add_compile_options(-Wno-unused-but-set-variable) # my clang doesn't know this FIXME: re-enable? endif() if(MACOSX) diff --git a/Sources/Engine/Base/Lists.cpp b/Sources/Engine/Base/Lists.cpp index c6ff234..5fe33bd 100755 --- a/Sources/Engine/Base/Lists.cpp +++ b/Sources/Engine/Base/Lists.cpp @@ -40,8 +40,8 @@ BOOL CListHead::IsValid(void) const { ASSERT(this!=NULL); ASSERT(lh_NULL == NULL); - ASSERT((lh_Head == (CListNode *) &lh_NULL) && (lh_Tail == (CListNode *) &lh_Head) - || lh_Tail->IsValid() && lh_Head->IsValid() ); + ASSERT(((lh_Head == (CListNode *) &lh_NULL) && (lh_Tail == (CListNode *) &lh_Head)) + || (lh_Tail->IsValid() && lh_Head->IsValid()) ); return TRUE; } @@ -211,7 +211,7 @@ BOOL CListNode::IsValid(void) const ASSERT((ln_Pred==NULL && ln_Succ==NULL) || (ln_Pred!=NULL && ln_Succ!=NULL)); // it is valid if it is cleared or if it is linked return (ln_Pred==NULL && ln_Succ==NULL) - || (ln_Pred->ln_Succ == this) && (ln_Succ->ln_Pred == this); + || ((ln_Pred->ln_Succ == this) && (ln_Succ->ln_Pred == this)); } /* diff --git a/Sources/Engine/Classes/MovableEntity.es b/Sources/Engine/Classes/MovableEntity.es index be11ae5..4a4a901 100644 --- a/Sources/Engine/Classes/MovableEntity.es +++ b/Sources/Engine/Classes/MovableEntity.es @@ -1009,8 +1009,8 @@ functions: } // find current breathing parameters BOOL bCanBreathe = - (ctUp.ct_ulFlags&CTF_BREATHABLE_LUNGS) && (en_ulPhysicsFlags&EPF_HASLUNGS) || - (ctUp.ct_ulFlags&CTF_BREATHABLE_GILLS) && (en_ulPhysicsFlags&EPF_HASGILLS); + ((ctUp.ct_ulFlags&CTF_BREATHABLE_LUNGS) && (en_ulPhysicsFlags&EPF_HASLUNGS)) || + ((ctUp.ct_ulFlags&CTF_BREATHABLE_GILLS) && (en_ulPhysicsFlags&EPF_HASGILLS)); TIME tmNow = _pTimer->CurrentTick(); TIME tmBreathDelay = tmNow-en_tmLastBreathed; // if entity can breathe now @@ -1207,8 +1207,8 @@ functions: // if polygon's steepness is too high CSurfaceType &stReference = en_pwoWorld->wo_astSurfaceTypes[pbpo->bpo_bppProperties.bpp_ubSurfaceType]; - if (fCos>=-stReference.st_fClimbSlopeCos&&fCos<0 - ||stReference.st_ulFlags&STF_SLIDEDOWNSLOPE) { + if ((fCos >= -stReference.st_fClimbSlopeCos && fCos<0) + || stReference.st_ulFlags&STF_SLIDEDOWNSLOPE) { // it cannot be below _pfPhysicsProfile.StopTimer((INDEX) CPhysicsProfile::PTI_ISSTANDINGONPOLYGON); return FALSE; @@ -1529,11 +1529,11 @@ out:; // going up or iStep==0 || // going forward and hit stairs or - iStep==1 && bHitStairsNow || + (iStep==1 && bHitStairsNow) || // going down and ends on something that is not high slope - iStep==2 && + (iStep==2 && (vHitPlane%en_vGravityDir<-stHit.st_fClimbSlopeCos || - bHitStairsNow); + bHitStairsNow)); // if early clip is allowed if (bEarlyClipAllowed || bSlidingAllowed) { @@ -2322,8 +2322,8 @@ out:; FLOAT fPlaneYAbs = Abs(fPlaneY); FLOAT fFriction = stReference.st_fFriction; // if on a steep slope - if (fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0 - ||(stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f) { + if ((fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0) + ||((stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f)) { en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE; // accellerate horizontaly towards desired absolute translation AddAccelerationOnPlane2( @@ -2737,8 +2737,8 @@ out:; /* old */ FLOAT fPlaneYAbs = Abs(fPlaneY); /* old */ FLOAT fFriction = stReference.st_fFriction; /* old */ // if on a steep slope -/* old */ if (fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0 -/* old */ ||(stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f) { +/* old */ if ((fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0) +/* old */ ||((stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f)) { /* old */ en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE; /* old */ // accellerate horizontaly towards desired absolute translation /* old */ AddAccelerationOnPlane2( diff --git a/Sources/Engine/Entities/Entity.cpp b/Sources/Engine/Entities/Entity.cpp index c88789b..de3acfe 100644 --- a/Sources/Engine/Entities/Entity.cpp +++ b/Sources/Engine/Entities/Entity.cpp @@ -1925,9 +1925,9 @@ void CEntity::FindSectorsAroundEntityNear(void) // (use more detailed testing for moving brushes) (en_RenderType!=RT_BRUSH|| // oriented box touches box of sector - (oboxEntity.HasContactWith(FLOATobbox3D(pbsc->bsc_boxBoundingBox)))&& + ((oboxEntity.HasContactWith(FLOATobbox3D(pbsc->bsc_boxBoundingBox)))&& // oriented box is in bsp - (pbsc->bsc_bspBSPTree.TestBox(oboxdEntity)>=0)); + (pbsc->bsc_bspBSPTree.TestBox(oboxdEntity)>=0))); // if it is not if (!bIn) { // if it has link @@ -3104,11 +3104,11 @@ void CEntity::InflictRangeDamage(CEntity *penInflictor, enum DamageType dmtType, FLOAT3D vHitPos; FLOAT fMinD; if ( - (en.en_RenderType==RT_MODEL || en.en_RenderType==RT_EDITORMODEL || + ((en.en_RenderType==RT_MODEL || en.en_RenderType==RT_EDITORMODEL || en.en_RenderType==RT_SKAMODEL || en.en_RenderType==RT_SKAEDITORMODEL )&& - CheckModelRangeDamage(en, vCenter, fMinD, vHitPos) || - (en.en_RenderType==RT_BRUSH)&& - CheckBrushRangeDamage(en, vCenter, fMinD, vHitPos)) { + CheckModelRangeDamage(en, vCenter, fMinD, vHitPos)) || + ((en.en_RenderType==RT_BRUSH)&& + CheckBrushRangeDamage(en, vCenter, fMinD, vHitPos))) { // find damage ammount FLOAT fAmmount = IntensityAtDistance(fDamageAmmount, fHotSpotRange, fFallOffRange, fMinD); diff --git a/Sources/Engine/Math/Object3D.cpp b/Sources/Engine/Math/Object3D.cpp index fb38369..0928c2f 100644 --- a/Sources/Engine/Math/Object3D.cpp +++ b/Sources/Engine/Math/Object3D.cpp @@ -81,7 +81,7 @@ void CObject3D::Project(CSimpleProjection3D_DOUBLE &pr) BOOL bXInverted = vObjectStretch(1)<0; BOOL bYInverted = vObjectStretch(2)<0; BOOL bZInverted = vObjectStretch(3)<0; - BOOL bInverted = bXInverted!=bYInverted!=bZInverted; + BOOL bInverted = (bXInverted != bYInverted) != bZInverted; // for all sectors FOREACHINDYNAMICARRAY(ob_aoscSectors, CObjectSector, itsc) { diff --git a/Sources/Engine/Math/Projection_Isometric.cpp b/Sources/Engine/Math/Projection_Isometric.cpp index 364a676..92f35d6 100644 --- a/Sources/Engine/Math/Projection_Isometric.cpp +++ b/Sources/Engine/Math/Projection_Isometric.cpp @@ -43,7 +43,9 @@ void CIsometricProjection3D::Prepare(void) BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bZInverted = pr_ObjectStretch(3)<0; - pr_bInverted = bXInverted!=bYInverted!=bZInverted; + // DG: this is true if either one of X,Y,Z is inverted, or all three + // but not if two or none are inverted. + pr_bInverted = (bXInverted != bYInverted) != bZInverted; // if the projection is mirrored if (pr_bMirror) { diff --git a/Sources/Engine/Math/Projection_Parallel.cpp b/Sources/Engine/Math/Projection_Parallel.cpp index fa0044c..2cc6ffe 100644 --- a/Sources/Engine/Math/Projection_Parallel.cpp +++ b/Sources/Engine/Math/Projection_Parallel.cpp @@ -43,7 +43,7 @@ void CParallelProjection3D::Prepare(void) BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bZInverted = pr_ObjectStretch(3)<0; - pr_bInverted = bXInverted!=bYInverted!=bZInverted; + pr_bInverted = (bXInverted != bYInverted) != bZInverted; // if the projection is mirrored if (pr_bMirror) { diff --git a/Sources/Engine/Math/Projection_Perspective.cpp b/Sources/Engine/Math/Projection_Perspective.cpp index 6d18df4..d26303a 100644 --- a/Sources/Engine/Math/Projection_Perspective.cpp +++ b/Sources/Engine/Math/Projection_Perspective.cpp @@ -52,7 +52,7 @@ void CPerspectiveProjection3D::Prepare(void) BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bZInverted = pr_ObjectStretch(3)<0; - pr_bInverted = bXInverted!=bYInverted!=bZInverted; + pr_bInverted = (bXInverted != bYInverted) != bZInverted; // if the projection is mirrored if (pr_bMirror) { diff --git a/Sources/Engine/Models/RenderModel.cpp b/Sources/Engine/Models/RenderModel.cpp index c148968..7b62f37 100644 --- a/Sources/Engine/Models/RenderModel.cpp +++ b/Sources/Engine/Models/RenderModel.cpp @@ -240,7 +240,7 @@ BOOL CModelObject::CreateAttachment( CRenderModel &rmMain, CAttachmentModelObjec _pfModelProfile.StartTimer( CModelProfile::PTI_CREATEATTACHMENT); _pfModelProfile.IncrementTimerAveragingCounter( CModelProfile::PTI_CREATEATTACHMENT); CRenderModel &rmAttached = *amo.amo_prm; - rmAttached.rm_ulFlags = rmMain.rm_ulFlags&(RMF_FOG|RMF_HAZE|RMF_WEAPON) | RMF_ATTACHMENT; + rmAttached.rm_ulFlags = (rmMain.rm_ulFlags & (RMF_FOG|RMF_HAZE|RMF_WEAPON)) | RMF_ATTACHMENT; // get the position rmMain.rm_pmdModelData->md_aampAttachedPosition.Lock(); @@ -493,7 +493,7 @@ void CModelObject::SetupModelRendering( CRenderModel &rm) BOOL bYInverted = rm.rm_vStretch(2) < 0; BOOL bZInverted = rm.rm_vStretch(3) < 0; rm.rm_ulFlags &= ~RMF_INVERTED; - if( bXInverted != bYInverted != bZInverted != _aprProjection->pr_bInverted) rm.rm_ulFlags |= RMF_INVERTED; + if( ((bXInverted != bYInverted) != bZInverted) != _aprProjection->pr_bInverted) rm.rm_ulFlags |= RMF_INVERTED; // prepare projections _pfModelProfile.StartTimer( CModelProfile::PTI_INITPROJECTION); diff --git a/Sources/Engine/Network/Server.cpp b/Sources/Engine/Network/Server.cpp index 4229ec0..084e417 100644 --- a/Sources/Engine/Network/Server.cpp +++ b/Sources/Engine/Network/Server.cpp @@ -459,8 +459,8 @@ void CServer::SendGameStreamBlocks(INDEX iClient) nmGameStreamBlocks.PackDefault(nmPackedBlocksNew); // if some blocks written already and the batch is too large if (iBlocksOk>0) { - if (iStep>0 && nmPackedBlocksNew.nm_slSize>=ctMaxBytes || - iStep<0 && nmPackedBlocksNew.nm_slSize>=ctMinBytes ) { + if ((iStep>0 && nmPackedBlocksNew.nm_slSize>=ctMaxBytes) || + (iStep<0 && nmPackedBlocksNew.nm_slSize>=ctMinBytes) ) { // stop // CPrintF("toomuch "); break; diff --git a/Sources/Engine/Rendering/RenCache.cpp b/Sources/Engine/Rendering/RenCache.cpp index 2297b58..dfc631d 100644 --- a/Sources/Engine/Rendering/RenCache.cpp +++ b/Sources/Engine/Rendering/RenCache.cpp @@ -449,8 +449,8 @@ inline void CRenderer::MakeScreenEdge( sed.sed_xI = (FIX16_16) (fI0 + ((FLOAT)sed.sed_pixTopJ-fJ0) * fDIoDJ ); } - ASSERT( sed.sed_xI > FIX16_16(-1.0f) - && sed.sed_xI < FIX16_16(re_fbbClipBox.Max()(1) + SENTINELEDGE_EPSILON) + ASSERT( (sed.sed_xI > FIX16_16(-1.0f) + && sed.sed_xI < FIX16_16(re_fbbClipBox.Max()(1) + SENTINELEDGE_EPSILON)) || (sed.sed_pixTopJ >= sed.sed_pixBottomJ)); // return the screen edge diff --git a/Sources/Engine/Rendering/Render.cpp b/Sources/Engine/Rendering/Render.cpp index 62c1450..7c23e99 100644 --- a/Sources/Engine/Rendering/Render.cpp +++ b/Sources/Engine/Rendering/Render.cpp @@ -870,9 +870,9 @@ void CRenderer::Render(void) // or not rendering second layer in world editor // and not in wireframe mode if( re_iIndex>0 - || !re_bRenderingShadows - && !re_pdpDrawPort->IsOverlappedRendering() - && _wrpWorldRenderPrefs.wrp_ftPolygons != CWorldRenderPrefs::FT_NONE) { + || (!re_bRenderingShadows + && !re_pdpDrawPort->IsOverlappedRendering() + && _wrpWorldRenderPrefs.wrp_ftPolygons != CWorldRenderPrefs::FT_NONE)) { re_pdpDrawPort->FillZBuffer(ZBUF_BACK); } // draw the prepared things to screen and finish diff --git a/Sources/Engine/Rendering/RenderAdding.cpp b/Sources/Engine/Rendering/RenderAdding.cpp index 50f7827..807f428 100644 --- a/Sources/Engine/Rendering/RenderAdding.cpp +++ b/Sources/Engine/Rendering/RenderAdding.cpp @@ -762,7 +762,7 @@ void CRenderer::AddZoningSectorsAroundBox(const FLOATaabbox3D &boxNear) continue; } // if it is not zoning brush - if (iten->en_RenderType!=CEntity::RT_BRUSH && iten->en_RenderType!=CEntity::RT_FIELDBRUSH + if ((iten->en_RenderType!=CEntity::RT_BRUSH && iten->en_RenderType!=CEntity::RT_FIELDBRUSH) ||!(iten->en_ulFlags&ENF_ZONING)) { // skip it continue; diff --git a/Sources/Engine/Sound/SoundLibrary.cpp b/Sources/Engine/Sound/SoundLibrary.cpp index 52ef87a..f1e4df3 100644 --- a/Sources/Engine/Sound/SoundLibrary.cpp +++ b/Sources/Engine/Sound/SoundLibrary.cpp @@ -1661,7 +1661,7 @@ void CSoundLibrary::MixSounds(void) _pfSoundProfile.IncrementCounter(CSoundProfile::PCI_MIXINGS, 1); ResetMixer( sl_pslMixerBuffer, slDataToMix); - BOOL bGamePaused = _pNetwork->IsPaused() || _pNetwork->IsServer() && _pNetwork->GetLocalPause(); + BOOL bGamePaused = _pNetwork->IsPaused() || (_pNetwork->IsServer() && _pNetwork->GetLocalPause()); // for each sound FOREACHINLIST( CSoundData, sd_Node, sl_ClhAwareList, itCsdSoundData) { diff --git a/Sources/Engine/World/World.cpp b/Sources/Engine/World/World.cpp index d524e2f..bff7b76 100644 --- a/Sources/Engine/World/World.cpp +++ b/Sources/Engine/World/World.cpp @@ -546,7 +546,7 @@ void CWorld::FindShadowLayers( CLightSource *pls = iten->GetLightSource(); if (pls!=NULL) { FLOATaabbox3D boxLight(iten->en_plPlacement.pl_PositionVector, pls->ls_rFallOff); - if ( bDirectional && (pls->ls_ulFlags &LSF_DIRECTIONAL) + if ( (bDirectional && (pls->ls_ulFlags & LSF_DIRECTIONAL)) ||boxLight.HasContactWith(boxNear)) { // find layers for that light source pls->FindShadowLayers(bSelectedOnly); @@ -970,8 +970,8 @@ void CWorld::MarkForPrediction(void) // find whether it is local BOOL bLocal = _pNetwork->IsPlayerLocal(pen); // if allowed for prediction - if ( bLocal && cli_bPredictLocalPlayers - || !bLocal && cli_bPredictRemotePlayers) { + if ( (bLocal && cli_bPredictLocalPlayers) + || (!bLocal && cli_bPredictRemotePlayers)) { // add it pen->AddToPrediction(); } diff --git a/Sources/EntitiesMP/Common/HUD.cpp b/Sources/EntitiesMP/Common/HUD.cpp index aeef67c..e4360d6 100644 --- a/Sources/EntitiesMP/Common/HUD.cpp +++ b/Sources/EntitiesMP/Common/HUD.cpp @@ -1181,7 +1181,7 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO if( iHealth>25) colHealth = _colHUD; if( iArmor >25) colArmor = _colHUD; // eventually print it out - if( hud_iShowPlayers==1 || hud_iShowPlayers==-1 && !bSinglePlay) { + if( hud_iShowPlayers==1 || (hud_iShowPlayers==-1 && !bSinglePlay)) { // printout location and info aren't the same for deathmatch and coop play const FLOAT fCharWidth = (PIX)((_pfdDisplayFont->GetWidth()-2) *fTextScale); if( bCooperative) { diff --git a/Sources/EntitiesMP/Debris.es b/Sources/EntitiesMP/Debris.es index 7354e2a..4a6cd59 100644 --- a/Sources/EntitiesMP/Debris.es +++ b/Sources/EntitiesMP/Debris.es @@ -99,7 +99,7 @@ functions: { // cannot be damaged immediately after spawning if ((_pTimer->CurrentTick()-m_tmStarted<1.0f) - ||(dmtType==DMT_CANNONBALL_EXPLOSION) && (_pTimer->CurrentTick()-m_tmStarted<5.0f)) { + ||((dmtType==DMT_CANNONBALL_EXPLOSION) && (_pTimer->CurrentTick()-m_tmStarted<5.0f))) { return; } CMovableModelEntity::ReceiveDamage(penInflictor, dmtType, fDamageAmmount, vHitPoint, vDirection); diff --git a/Sources/EntitiesMP/Dragonman.es b/Sources/EntitiesMP/Dragonman.es index 4f03e16..fb6052c 100644 --- a/Sources/EntitiesMP/Dragonman.es +++ b/Sources/EntitiesMP/Dragonman.es @@ -459,8 +459,8 @@ procedures: Hit(EVoid) : CEnemyBase::Hit { // burn enemy - if (m_EdtType == DT_SERGEANT && CalcDist(m_penEnemy) <= 6.0f || - m_EdtType == DT_MONSTER && CalcDist(m_penEnemy) <= 20.0f) { + if ((m_EdtType == DT_SERGEANT && CalcDist(m_penEnemy) <= 6.0f) || + (m_EdtType == DT_MONSTER && CalcDist(m_penEnemy) <= 20.0f)) { jump BurnEnemy(); } diff --git a/Sources/EntitiesMP/Effector.es b/Sources/EntitiesMP/Effector.es index 0d9d873..f75b28e 100644 --- a/Sources/EntitiesMP/Effector.es +++ b/Sources/EntitiesMP/Effector.es @@ -125,7 +125,7 @@ functions: void AdjustMipFactor(FLOAT &fMipFactor) { - if (m_eetType==ET_DISAPPEAR_MODEL || m_eetType==ET_DISAPPEAR_MODEL_NOW && m_penModel!=NULL) + if (m_eetType==ET_DISAPPEAR_MODEL || (m_eetType==ET_DISAPPEAR_MODEL_NOW && m_penModel!=NULL)) { CModelObject *pmo = m_penModel->GetModelObject(); TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted; @@ -146,7 +146,7 @@ functions: COLOR col = C_WHITE|ubAlpha; pmo->mo_colBlendColor = col; } - if (m_eetType==ET_APPEAR_MODEL || m_eetType==ET_APPEAR_MODEL_NOW && m_penModel!=NULL) + if (m_eetType==ET_APPEAR_MODEL || (m_eetType==ET_APPEAR_MODEL_NOW && m_penModel!=NULL)) { CModelObject *pmo = m_penModel->GetModelObject(); TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted; @@ -449,7 +449,9 @@ procedures: // setup light source if (m_bLightSource) { SetupLightSource(); } - while(_pTimer->CurrentTick()CurrentTick()CurrentTick()CurrentTick()CurrentTick()IsPredicted()||IsPredictor()&&m_penView->IsPredictor()||!IsPredicted()&&!m_penView->IsPredicted()&&!IsPredictor()&&!m_penView->IsPredictor()); + ASSERT((IsPredicted()&&m_penView->IsPredicted()) || (IsPredictor()&&m_penView->IsPredictor()) + || (!IsPredicted()&&!m_penView->IsPredicted()&&!IsPredictor()&&!m_penView->IsPredictor())); en_plViewpoint.pl_PositionVector = FLOAT3D(0, 1, 0); en_plViewpoint.pl_OrientationAngle += (ANGLE3D( (ANGLE)((FLOAT)paAction.pa_aRotation(1)*_pTimer->TickQuantum), diff --git a/Sources/EntitiesMP/PlayerWeapons.es b/Sources/EntitiesMP/PlayerWeapons.es index 4ab5858..1b2176a 100755 --- a/Sources/EntitiesMP/PlayerWeapons.es +++ b/Sources/EntitiesMP/PlayerWeapons.es @@ -1101,7 +1101,7 @@ functions: } } // apply cannon draw - else if( (m_iCurrentWeapon == WEAPON_IRONCANNON) /*|| + else if( m_iCurrentWeapon == WEAPON_IRONCANNON /*|| (m_iCurrentWeapon == WEAPON_NUKECANNON) */) { FLOAT fLerpedMovement = Lerp(m_fWeaponDrawPowerOld, m_fWeaponDrawPower, _pTimer->GetLerpFactor()); @@ -4008,7 +4008,7 @@ procedures: GetAnimator()->FireAnimation(BODY_ANIM_SHOTGUN_FIRESHORT, AOF_LOOPING); } else if (m_iCurrentWeapon==WEAPON_TOMMYGUN) { autocall TommyGunStart() EEnd; - } else if ((m_iCurrentWeapon==WEAPON_IRONCANNON) /*|| (m_iCurrentWeapon==WEAPON_NUKECANNON)*/) { + } else if (m_iCurrentWeapon==WEAPON_IRONCANNON /*|| (m_iCurrentWeapon==WEAPON_NUKECANNON)*/) { jump CannonFireStart(); } diff --git a/Sources/GameMP/Computer.cpp b/Sources/GameMP/Computer.cpp index e1106e1..fa6cba2 100644 --- a/Sources/GameMP/Computer.cpp +++ b/Sources/GameMP/Computer.cpp @@ -246,7 +246,7 @@ void LastUnreadMessage(void) // go to next/previous message void PrevMessage(void) { - if (_iActiveMessage<_acmMessages.Count()==0) { + if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about? return; } _iActiveMessage--; @@ -258,7 +258,7 @@ void PrevMessage(void) void NextMessage(void) { - if (_iActiveMessage<_acmMessages.Count()==0) { + if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about? return; } _iActiveMessage++; @@ -305,7 +305,7 @@ void MessageTextUp(INDEX ctLines) void MessageTextDn(INDEX ctLines) { // if no message do nothing - if (_iActiveMessage<_acmMessages.Count()==0) { + if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about? return; } // find text lines count @@ -874,7 +874,7 @@ static void ComputerOff(void) static void ExitRequested(void) { // if end of game - if (_ppenPlayer!=NULL && _ppenPlayer->m_bEndOfGame || _pNetwork->IsGameFinished()) { + if ((_ppenPlayer!=NULL && _ppenPlayer->m_bEndOfGame) || _pNetwork->IsGameFinished()) { // if in single player if (GetSP()->sp_bSinglePlayer) { // request app to show high score diff --git a/Sources/GameMP/Game.cpp b/Sources/GameMP/Game.cpp index 47bc642..0b9a2dd 100755 --- a/Sources/GameMP/Game.cpp +++ b/Sources/GameMP/Game.cpp @@ -1987,12 +1987,12 @@ static void MakeSplitDrawports(enum CGame::SplitScreenCfg ssc, INDEX iCount, CDr } // if one player or observer with one screen - if (ssc==CGame::SSC_PLAY1 || ssc==CGame::SSC_OBSERVER && iCount==1) { + if (ssc==CGame::SSC_PLAY1 || (ssc==CGame::SSC_OBSERVER && iCount==1)) { // the only drawport covers entire screen adpDrawPorts[0] = CDrawPort( pdp, 0.0, 0.0, 1.0, 1.0); apdpDrawPorts[0] = &adpDrawPorts[0]; // if two players or observer with two screens - } else if (ssc==CGame::SSC_PLAY2 || ssc==CGame::SSC_OBSERVER && iCount==2) { + } else if (ssc==CGame::SSC_PLAY2 || (ssc==CGame::SSC_OBSERVER && iCount==2)) { // if the drawport is not dualhead if (!pdp->IsDualHead()) { // need two drawports for filling the empty spaces left and right @@ -2016,7 +2016,7 @@ static void MakeSplitDrawports(enum CGame::SplitScreenCfg ssc, INDEX iCount, CDr apdpDrawPorts[1] = &adpDrawPorts[1]; } // if three players or observer with three screens - } else if (ssc==CGame::SSC_PLAY3 || ssc==CGame::SSC_OBSERVER && iCount==3) { + } else if (ssc==CGame::SSC_PLAY3 || (ssc==CGame::SSC_OBSERVER && iCount==3)) { // if the drawport is not dualhead if (!pdp->IsDualHead()) { // need two drawports for filling the empty spaces left and right @@ -2053,7 +2053,7 @@ static void MakeSplitDrawports(enum CGame::SplitScreenCfg ssc, INDEX iCount, CDr apdpDrawPorts[2] = &adpDrawPorts[2]; } // if four players or observer with four screens - } else if (ssc==CGame::SSC_PLAY4 || ssc==CGame::SSC_OBSERVER && iCount==4) { + } else if (ssc==CGame::SSC_PLAY4 || (ssc==CGame::SSC_OBSERVER && iCount==4)) { // if the drawport is not dualhead if (!pdp->IsDualHead()) { // first of four draw ports covers upper-left part of the screen diff --git a/Sources/GameMP/Game.h b/Sources/GameMP/Game.h index f2289a1..5821ae2 100644 --- a/Sources/GameMP/Game.h +++ b/Sources/GameMP/Game.h @@ -76,7 +76,7 @@ class CButtonAction { public: // default constructor CButtonAction(); - ~CButtonAction() {} + virtual ~CButtonAction() {} CListNode ba_lnNode; INDEX ba_iFirstKey; BOOL ba_bFirstKeyDown; diff --git a/Sources/GameMP/WEDInterface.cpp b/Sources/GameMP/WEDInterface.cpp index fc6e8e0..7caf78b 100644 --- a/Sources/GameMP/WEDInterface.cpp +++ b/Sources/GameMP/WEDInterface.cpp @@ -116,7 +116,7 @@ void CGame::QuickTest(const CTFileName &fnMapName, // if it is not a mouse message if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST)) { // if not system key messages - if( !(msg.message==WM_KEYDOWN && msg.wParam==VK_F10 + if( !((msg.message==WM_KEYDOWN && msg.wParam==VK_F10) ||msg.message==WM_SYSKEYDOWN)) { // dispatch it TranslateMessage(&msg); diff --git a/Sources/SeriousSam/SeriousSam.cpp b/Sources/SeriousSam/SeriousSam.cpp index 9b76471..1a15bcf 100644 --- a/Sources/SeriousSam/SeriousSam.cpp +++ b/Sources/SeriousSam/SeriousSam.cpp @@ -744,8 +744,8 @@ void DoGame(void) // set flag if not in game if( !_pGame->gm_bGameOn) _gmRunningGameMode = GM_NONE; - if( _gmRunningGameMode==GM_DEMO && _pNetwork->IsDemoPlayFinished() - ||_gmRunningGameMode==GM_INTRO && _pNetwork->IsGameFinished()) { + if( (_gmRunningGameMode==GM_DEMO && _pNetwork->IsDemoPlayFinished()) + ||(_gmRunningGameMode==GM_INTRO && _pNetwork->IsGameFinished())) { _pGame->StopGame(); _gmRunningGameMode = GM_NONE; @@ -942,7 +942,7 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int // if it is not a mouse message if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST) ) { // if not system key messages - if( !(msg.message==WM_KEYDOWN && msg.wParam==VK_F10 + if( !((msg.message==WM_KEYDOWN && msg.wParam==VK_F10) ||msg.message==WM_SYSKEYDOWN)) { // dispatch it TranslateMessage(&msg); @@ -1171,6 +1171,7 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int // if toggling console BOOL bConsoleKey = sam_bToggleConsole || msg.message==WM_KEYDOWN && // !!! FIXME: rcg11162001 This sucks. + // FIXME: DG: we could use SDL_SCANCODE_GRAVE ? #ifdef PLATFORM_UNIX (msg.wParam == SDLK_BACKQUOTE #else