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.
This commit is contained in:
Daniel Gibson 2016-04-23 20:25:08 +02:00
parent 72edf1c720
commit dbe524f0b2
28 changed files with 79 additions and 71 deletions

View File

@ -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") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
# TODO fix these warnings # 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-sign-compare)
add_compile_options(-Wno-switch) add_compile_options(-Wno-switch)
add_compile_options(-Wno-char-subscripts) 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-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-unused-value) # same here (the Scripts generate tons of unused variables and values)
add_compile_options(-Wno-missing-braces) 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!") MESSAGE(WARNING, "re-enable some of the warnings some day!")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") 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) # don't complain about if(this!=NULL)
add_compile_options(-Wno-tautological-undefined-compare)
add_compile_options(-Wno-c++11-compat-deprecated-writable-strings) 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() # most probably GCC
else() add_compile_options(-Wno-unused-but-set-variable) # my clang doesn't know this FIXME: re-enable?
add_compile_options(-Wno-unused-but-set-variable) # my clang doesn't know this
endif() endif()
if(MACOSX) if(MACOSX)

View File

@ -40,8 +40,8 @@ BOOL CListHead::IsValid(void) const
{ {
ASSERT(this!=NULL); ASSERT(this!=NULL);
ASSERT(lh_NULL == NULL); ASSERT(lh_NULL == NULL);
ASSERT((lh_Head == (CListNode *) &lh_NULL) && (lh_Tail == (CListNode *) &lh_Head) ASSERT(((lh_Head == (CListNode *) &lh_NULL) && (lh_Tail == (CListNode *) &lh_Head))
|| lh_Tail->IsValid() && lh_Head->IsValid() ); || (lh_Tail->IsValid() && lh_Head->IsValid()) );
return TRUE; return TRUE;
} }
@ -211,7 +211,7 @@ BOOL CListNode::IsValid(void) const
ASSERT((ln_Pred==NULL && ln_Succ==NULL) || (ln_Pred!=NULL && ln_Succ!=NULL)); 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 // it is valid if it is cleared or if it is linked
return (ln_Pred==NULL && ln_Succ==NULL) 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));
} }
/* /*

View File

@ -1009,8 +1009,8 @@ functions:
} }
// find current breathing parameters // find current breathing parameters
BOOL bCanBreathe = BOOL bCanBreathe =
(ctUp.ct_ulFlags&CTF_BREATHABLE_LUNGS) && (en_ulPhysicsFlags&EPF_HASLUNGS) || ((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_GILLS) && (en_ulPhysicsFlags&EPF_HASGILLS));
TIME tmNow = _pTimer->CurrentTick(); TIME tmNow = _pTimer->CurrentTick();
TIME tmBreathDelay = tmNow-en_tmLastBreathed; TIME tmBreathDelay = tmNow-en_tmLastBreathed;
// if entity can breathe now // if entity can breathe now
@ -1207,8 +1207,8 @@ functions:
// if polygon's steepness is too high // if polygon's steepness is too high
CSurfaceType &stReference = en_pwoWorld->wo_astSurfaceTypes[pbpo->bpo_bppProperties.bpp_ubSurfaceType]; CSurfaceType &stReference = en_pwoWorld->wo_astSurfaceTypes[pbpo->bpo_bppProperties.bpp_ubSurfaceType];
if (fCos>=-stReference.st_fClimbSlopeCos&&fCos<0 if ((fCos >= -stReference.st_fClimbSlopeCos && fCos<0)
||stReference.st_ulFlags&STF_SLIDEDOWNSLOPE) { || stReference.st_ulFlags&STF_SLIDEDOWNSLOPE) {
// it cannot be below // it cannot be below
_pfPhysicsProfile.StopTimer((INDEX) CPhysicsProfile::PTI_ISSTANDINGONPOLYGON); _pfPhysicsProfile.StopTimer((INDEX) CPhysicsProfile::PTI_ISSTANDINGONPOLYGON);
return FALSE; return FALSE;
@ -1529,11 +1529,11 @@ out:;
// going up or // going up or
iStep==0 || iStep==0 ||
// going forward and hit stairs or // going forward and hit stairs or
iStep==1 && bHitStairsNow || (iStep==1 && bHitStairsNow) ||
// going down and ends on something that is not high slope // going down and ends on something that is not high slope
iStep==2 && (iStep==2 &&
(vHitPlane%en_vGravityDir<-stHit.st_fClimbSlopeCos || (vHitPlane%en_vGravityDir<-stHit.st_fClimbSlopeCos ||
bHitStairsNow); bHitStairsNow));
// if early clip is allowed // if early clip is allowed
if (bEarlyClipAllowed || bSlidingAllowed) { if (bEarlyClipAllowed || bSlidingAllowed) {
@ -2322,8 +2322,8 @@ out:;
FLOAT fPlaneYAbs = Abs(fPlaneY); FLOAT fPlaneYAbs = Abs(fPlaneY);
FLOAT fFriction = stReference.st_fFriction; FLOAT fFriction = stReference.st_fFriction;
// if on a steep slope // if on a steep slope
if (fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0 if ((fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0)
||(stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f) { ||((stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f)) {
en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE; en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE;
// accellerate horizontaly towards desired absolute translation // accellerate horizontaly towards desired absolute translation
AddAccelerationOnPlane2( AddAccelerationOnPlane2(
@ -2737,8 +2737,8 @@ out:;
/* old */ FLOAT fPlaneYAbs = Abs(fPlaneY); /* old */ FLOAT fPlaneYAbs = Abs(fPlaneY);
/* old */ FLOAT fFriction = stReference.st_fFriction; /* old */ FLOAT fFriction = stReference.st_fFriction;
/* old */ // if on a steep slope /* old */ // if on a steep slope
/* old */ if (fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0 /* old */ if ((fPlaneY>=-stReference.st_fClimbSlopeCos&&fPlaneY<0)
/* old */ ||(stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f) { /* old */ ||((stReference.st_ulFlags&STF_SLIDEDOWNSLOPE)&&fPlaneY>-0.99f)) {
/* old */ en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE; /* old */ en_ulPhysicsFlags|=EPF_ONSTEEPSLOPE;
/* old */ // accellerate horizontaly towards desired absolute translation /* old */ // accellerate horizontaly towards desired absolute translation
/* old */ AddAccelerationOnPlane2( /* old */ AddAccelerationOnPlane2(

View File

@ -1925,9 +1925,9 @@ void CEntity::FindSectorsAroundEntityNear(void)
// (use more detailed testing for moving brushes) // (use more detailed testing for moving brushes)
(en_RenderType!=RT_BRUSH|| (en_RenderType!=RT_BRUSH||
// oriented box touches box of sector // oriented box touches box of sector
(oboxEntity.HasContactWith(FLOATobbox3D(pbsc->bsc_boxBoundingBox)))&& ((oboxEntity.HasContactWith(FLOATobbox3D(pbsc->bsc_boxBoundingBox)))&&
// oriented box is in bsp // oriented box is in bsp
(pbsc->bsc_bspBSPTree.TestBox(oboxdEntity)>=0)); (pbsc->bsc_bspBSPTree.TestBox(oboxdEntity)>=0)));
// if it is not // if it is not
if (!bIn) { if (!bIn) {
// if it has link // if it has link
@ -3104,11 +3104,11 @@ void CEntity::InflictRangeDamage(CEntity *penInflictor, enum DamageType dmtType,
FLOAT3D vHitPos; FLOAT3D vHitPos;
FLOAT fMinD; FLOAT fMinD;
if ( 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 )&& en.en_RenderType==RT_SKAMODEL || en.en_RenderType==RT_SKAEDITORMODEL )&&
CheckModelRangeDamage(en, vCenter, fMinD, vHitPos) || CheckModelRangeDamage(en, vCenter, fMinD, vHitPos)) ||
(en.en_RenderType==RT_BRUSH)&& ((en.en_RenderType==RT_BRUSH)&&
CheckBrushRangeDamage(en, vCenter, fMinD, vHitPos)) { CheckBrushRangeDamage(en, vCenter, fMinD, vHitPos))) {
// find damage ammount // find damage ammount
FLOAT fAmmount = IntensityAtDistance(fDamageAmmount, fHotSpotRange, fFallOffRange, fMinD); FLOAT fAmmount = IntensityAtDistance(fDamageAmmount, fHotSpotRange, fFallOffRange, fMinD);

View File

@ -81,7 +81,7 @@ void CObject3D::Project(CSimpleProjection3D_DOUBLE &pr)
BOOL bXInverted = vObjectStretch(1)<0; BOOL bXInverted = vObjectStretch(1)<0;
BOOL bYInverted = vObjectStretch(2)<0; BOOL bYInverted = vObjectStretch(2)<0;
BOOL bZInverted = vObjectStretch(3)<0; BOOL bZInverted = vObjectStretch(3)<0;
BOOL bInverted = bXInverted!=bYInverted!=bZInverted; BOOL bInverted = (bXInverted != bYInverted) != bZInverted;
// for all sectors // for all sectors
FOREACHINDYNAMICARRAY(ob_aoscSectors, CObjectSector, itsc) { FOREACHINDYNAMICARRAY(ob_aoscSectors, CObjectSector, itsc) {

View File

@ -43,7 +43,9 @@ void CIsometricProjection3D::Prepare(void)
BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bYInverted = pr_ObjectStretch(2)<0;
BOOL bZInverted = pr_ObjectStretch(3)<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 the projection is mirrored
if (pr_bMirror) { if (pr_bMirror) {

View File

@ -43,7 +43,7 @@ void CParallelProjection3D::Prepare(void)
BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bYInverted = pr_ObjectStretch(2)<0;
BOOL bZInverted = pr_ObjectStretch(3)<0; BOOL bZInverted = pr_ObjectStretch(3)<0;
pr_bInverted = bXInverted!=bYInverted!=bZInverted; pr_bInverted = (bXInverted != bYInverted) != bZInverted;
// if the projection is mirrored // if the projection is mirrored
if (pr_bMirror) { if (pr_bMirror) {

View File

@ -52,7 +52,7 @@ void CPerspectiveProjection3D::Prepare(void)
BOOL bYInverted = pr_ObjectStretch(2)<0; BOOL bYInverted = pr_ObjectStretch(2)<0;
BOOL bZInverted = pr_ObjectStretch(3)<0; BOOL bZInverted = pr_ObjectStretch(3)<0;
pr_bInverted = bXInverted!=bYInverted!=bZInverted; pr_bInverted = (bXInverted != bYInverted) != bZInverted;
// if the projection is mirrored // if the projection is mirrored
if (pr_bMirror) { if (pr_bMirror) {

View File

@ -240,7 +240,7 @@ BOOL CModelObject::CreateAttachment( CRenderModel &rmMain, CAttachmentModelObjec
_pfModelProfile.StartTimer( CModelProfile::PTI_CREATEATTACHMENT); _pfModelProfile.StartTimer( CModelProfile::PTI_CREATEATTACHMENT);
_pfModelProfile.IncrementTimerAveragingCounter( CModelProfile::PTI_CREATEATTACHMENT); _pfModelProfile.IncrementTimerAveragingCounter( CModelProfile::PTI_CREATEATTACHMENT);
CRenderModel &rmAttached = *amo.amo_prm; 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 // get the position
rmMain.rm_pmdModelData->md_aampAttachedPosition.Lock(); rmMain.rm_pmdModelData->md_aampAttachedPosition.Lock();
@ -493,7 +493,7 @@ void CModelObject::SetupModelRendering( CRenderModel &rm)
BOOL bYInverted = rm.rm_vStretch(2) < 0; BOOL bYInverted = rm.rm_vStretch(2) < 0;
BOOL bZInverted = rm.rm_vStretch(3) < 0; BOOL bZInverted = rm.rm_vStretch(3) < 0;
rm.rm_ulFlags &= ~RMF_INVERTED; 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 // prepare projections
_pfModelProfile.StartTimer( CModelProfile::PTI_INITPROJECTION); _pfModelProfile.StartTimer( CModelProfile::PTI_INITPROJECTION);

View File

@ -459,8 +459,8 @@ void CServer::SendGameStreamBlocks(INDEX iClient)
nmGameStreamBlocks.PackDefault(nmPackedBlocksNew); nmGameStreamBlocks.PackDefault(nmPackedBlocksNew);
// if some blocks written already and the batch is too large // if some blocks written already and the batch is too large
if (iBlocksOk>0) { if (iBlocksOk>0) {
if (iStep>0 && nmPackedBlocksNew.nm_slSize>=ctMaxBytes || if ((iStep>0 && nmPackedBlocksNew.nm_slSize>=ctMaxBytes) ||
iStep<0 && nmPackedBlocksNew.nm_slSize>=ctMinBytes ) { (iStep<0 && nmPackedBlocksNew.nm_slSize>=ctMinBytes) ) {
// stop // stop
// CPrintF("toomuch "); // CPrintF("toomuch ");
break; break;

View File

@ -449,8 +449,8 @@ inline void CRenderer::MakeScreenEdge(
sed.sed_xI = (FIX16_16) (fI0 + ((FLOAT)sed.sed_pixTopJ-fJ0) * fDIoDJ ); sed.sed_xI = (FIX16_16) (fI0 + ((FLOAT)sed.sed_pixTopJ-fJ0) * fDIoDJ );
} }
ASSERT( sed.sed_xI > FIX16_16(-1.0f) ASSERT( (sed.sed_xI > FIX16_16(-1.0f)
&& sed.sed_xI < FIX16_16(re_fbbClipBox.Max()(1) + SENTINELEDGE_EPSILON) && sed.sed_xI < FIX16_16(re_fbbClipBox.Max()(1) + SENTINELEDGE_EPSILON))
|| (sed.sed_pixTopJ >= sed.sed_pixBottomJ)); || (sed.sed_pixTopJ >= sed.sed_pixBottomJ));
// return the screen edge // return the screen edge

View File

@ -870,9 +870,9 @@ void CRenderer::Render(void)
// or not rendering second layer in world editor // or not rendering second layer in world editor
// and not in wireframe mode // and not in wireframe mode
if( re_iIndex>0 if( re_iIndex>0
|| !re_bRenderingShadows || (!re_bRenderingShadows
&& !re_pdpDrawPort->IsOverlappedRendering() && !re_pdpDrawPort->IsOverlappedRendering()
&& _wrpWorldRenderPrefs.wrp_ftPolygons != CWorldRenderPrefs::FT_NONE) { && _wrpWorldRenderPrefs.wrp_ftPolygons != CWorldRenderPrefs::FT_NONE)) {
re_pdpDrawPort->FillZBuffer(ZBUF_BACK); re_pdpDrawPort->FillZBuffer(ZBUF_BACK);
} }
// draw the prepared things to screen and finish // draw the prepared things to screen and finish

View File

@ -762,7 +762,7 @@ void CRenderer::AddZoningSectorsAroundBox(const FLOATaabbox3D &boxNear)
continue; continue;
} }
// if it is not zoning brush // 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)) { ||!(iten->en_ulFlags&ENF_ZONING)) {
// skip it // skip it
continue; continue;

View File

@ -1661,7 +1661,7 @@ void CSoundLibrary::MixSounds(void)
_pfSoundProfile.IncrementCounter(CSoundProfile::PCI_MIXINGS, 1); _pfSoundProfile.IncrementCounter(CSoundProfile::PCI_MIXINGS, 1);
ResetMixer( sl_pslMixerBuffer, slDataToMix); ResetMixer( sl_pslMixerBuffer, slDataToMix);
BOOL bGamePaused = _pNetwork->IsPaused() || _pNetwork->IsServer() && _pNetwork->GetLocalPause(); BOOL bGamePaused = _pNetwork->IsPaused() || (_pNetwork->IsServer() && _pNetwork->GetLocalPause());
// for each sound // for each sound
FOREACHINLIST( CSoundData, sd_Node, sl_ClhAwareList, itCsdSoundData) { FOREACHINLIST( CSoundData, sd_Node, sl_ClhAwareList, itCsdSoundData) {

View File

@ -546,7 +546,7 @@ void CWorld::FindShadowLayers(
CLightSource *pls = iten->GetLightSource(); CLightSource *pls = iten->GetLightSource();
if (pls!=NULL) { if (pls!=NULL) {
FLOATaabbox3D boxLight(iten->en_plPlacement.pl_PositionVector, pls->ls_rFallOff); 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)) { ||boxLight.HasContactWith(boxNear)) {
// find layers for that light source // find layers for that light source
pls->FindShadowLayers(bSelectedOnly); pls->FindShadowLayers(bSelectedOnly);
@ -970,8 +970,8 @@ void CWorld::MarkForPrediction(void)
// find whether it is local // find whether it is local
BOOL bLocal = _pNetwork->IsPlayerLocal(pen); BOOL bLocal = _pNetwork->IsPlayerLocal(pen);
// if allowed for prediction // if allowed for prediction
if ( bLocal && cli_bPredictLocalPlayers if ( (bLocal && cli_bPredictLocalPlayers)
|| !bLocal && cli_bPredictRemotePlayers) { || (!bLocal && cli_bPredictRemotePlayers)) {
// add it // add it
pen->AddToPrediction(); pen->AddToPrediction();
} }

View File

@ -1181,7 +1181,7 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
if( iHealth>25) colHealth = _colHUD; if( iHealth>25) colHealth = _colHUD;
if( iArmor >25) colArmor = _colHUD; if( iArmor >25) colArmor = _colHUD;
// eventually print it out // 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 // printout location and info aren't the same for deathmatch and coop play
const FLOAT fCharWidth = (PIX)((_pfdDisplayFont->GetWidth()-2) *fTextScale); const FLOAT fCharWidth = (PIX)((_pfdDisplayFont->GetWidth()-2) *fTextScale);
if( bCooperative) { if( bCooperative) {

View File

@ -99,7 +99,7 @@ functions:
{ {
// cannot be damaged immediately after spawning // cannot be damaged immediately after spawning
if ((_pTimer->CurrentTick()-m_tmStarted<1.0f) 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; return;
} }
CMovableModelEntity::ReceiveDamage(penInflictor, dmtType, fDamageAmmount, vHitPoint, vDirection); CMovableModelEntity::ReceiveDamage(penInflictor, dmtType, fDamageAmmount, vHitPoint, vDirection);

View File

@ -459,8 +459,8 @@ procedures:
Hit(EVoid) : CEnemyBase::Hit { Hit(EVoid) : CEnemyBase::Hit {
// burn enemy // burn enemy
if (m_EdtType == DT_SERGEANT && CalcDist(m_penEnemy) <= 6.0f || if ((m_EdtType == DT_SERGEANT && CalcDist(m_penEnemy) <= 6.0f) ||
m_EdtType == DT_MONSTER && CalcDist(m_penEnemy) <= 20.0f) { (m_EdtType == DT_MONSTER && CalcDist(m_penEnemy) <= 20.0f)) {
jump BurnEnemy(); jump BurnEnemy();
} }

View File

@ -125,7 +125,7 @@ functions:
void AdjustMipFactor(FLOAT &fMipFactor) 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(); CModelObject *pmo = m_penModel->GetModelObject();
TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted; TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted;
@ -146,7 +146,7 @@ functions:
COLOR col = C_WHITE|ubAlpha; COLOR col = C_WHITE|ubAlpha;
pmo->mo_colBlendColor = col; 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(); CModelObject *pmo = m_penModel->GetModelObject();
TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted; TIME tmDelta = _pTimer->GetLerpedCurrentTick()-m_tmStarted;
@ -449,7 +449,9 @@ procedures:
// setup light source // setup light source
if (m_bLightSource) { SetupLightSource(); } if (m_bLightSource) { SetupLightSource(); }
while(_pTimer->CurrentTick()<m_tmStarted+m_tmLifeTime && m_bAlive || m_bWaitTrigger) // FIXME: DG: I'm not 100% sure about the loop-condition, I added parenthesis that
// reflect the orig behavior to shut compiler warnings up
while(((_pTimer->CurrentTick()<m_tmStarted+m_tmLifeTime) && m_bAlive) || m_bWaitTrigger)
{ {
wait( 0.25f) wait( 0.25f)
{ {

View File

@ -1373,7 +1373,7 @@ procedures:
autocall FallOnFloor() EReturn; autocall FallOnFloor() EReturn;
} }
if (m_EecChar==ELC_LARGE || m_EecChar==ELC_BIG && m_EetType==ELT_LAVA) if (m_EecChar==ELC_LARGE || (m_EecChar==ELC_BIG && m_EetType==ELT_LAVA))
{ {
PlaySound(m_soBackground, SOUND_LAVA_LAVABURN, SOF_3D|SOF_LOOP); PlaySound(m_soBackground, SOUND_LAVA_LAVABURN, SOF_3D|SOF_LOOP);
} }

View File

@ -283,6 +283,9 @@ procedures:
// declare yourself as a model // declare yourself as a model
InitAsModel(); InitAsModel();
// fish must not go upstairs, or it will get out of water // fish must not go upstairs, or it will get out of water
// FIXME: DG: should it really be
// (EPF_MODEL_WALKING|EPF_HASGILLS) & ~EPF_ONBLOCK_CLIMBORSLIDE ) | EPF_ONBLOCK_SLIDE
// or rather (EPF_MODEL_WALKING|EPF_HASGILLS) & ~(EPF_ONBLOCK_CLIMBORSLIDE|EPF_ONBLOCK_SLIDE) ??
SetPhysicsFlags((EPF_MODEL_WALKING|EPF_HASGILLS)&~EPF_ONBLOCK_CLIMBORSLIDE|EPF_ONBLOCK_SLIDE); SetPhysicsFlags((EPF_MODEL_WALKING|EPF_HASGILLS)&~EPF_ONBLOCK_CLIMBORSLIDE|EPF_ONBLOCK_SLIDE);
SetCollisionFlags(ECF_MODEL); SetCollisionFlags(ECF_MODEL);
SetFlags(GetFlags()|ENF_ALIVE); SetFlags(GetFlags()|ENF_ALIVE);

View File

@ -503,8 +503,8 @@ DECL_DLL void ctl_ComposeActionPacket(const CPlayerCharacter &pc, CPlayerAction
// add button movement/rotation/look actions to the axis actions // add button movement/rotation/look actions to the axis actions
if(pctlCurrent.bMoveForward ) paAction.pa_vTranslation(3) -= plr_fSpeedForward; if(pctlCurrent.bMoveForward ) paAction.pa_vTranslation(3) -= plr_fSpeedForward;
if(pctlCurrent.bMoveBackward ) paAction.pa_vTranslation(3) += plr_fSpeedBackward; if(pctlCurrent.bMoveBackward ) paAction.pa_vTranslation(3) += plr_fSpeedBackward;
if(pctlCurrent.bMoveLeft || pctlCurrent.bStrafe&&pctlCurrent.bTurnLeft) paAction.pa_vTranslation(1) -= plr_fSpeedSide; if(pctlCurrent.bMoveLeft || (pctlCurrent.bStrafe&&pctlCurrent.bTurnLeft)) paAction.pa_vTranslation(1) -= plr_fSpeedSide;
if(pctlCurrent.bMoveRight || pctlCurrent.bStrafe&&pctlCurrent.bTurnRight) paAction.pa_vTranslation(1) += plr_fSpeedSide; if(pctlCurrent.bMoveRight || (pctlCurrent.bStrafe&&pctlCurrent.bTurnRight)) paAction.pa_vTranslation(1) += plr_fSpeedSide;
if(pctlCurrent.bMoveUp ) paAction.pa_vTranslation(2) += plr_fSpeedUp; if(pctlCurrent.bMoveUp ) paAction.pa_vTranslation(2) += plr_fSpeedUp;
if(pctlCurrent.bMoveDown ) paAction.pa_vTranslation(2) -= plr_fSpeedUp; if(pctlCurrent.bMoveDown ) paAction.pa_vTranslation(2) -= plr_fSpeedUp;
@ -4264,7 +4264,7 @@ functions:
} }
// if just started swimming // if just started swimming
if (m_pstState == PST_SWIM && _pTimer->CurrentTick()<m_fSwimTime+0.5f if ((m_pstState == PST_SWIM && _pTimer->CurrentTick()<m_fSwimTime+0.5f)
||_pTimer->CurrentTick()<m_tmOutOfWater+0.5f) { ||_pTimer->CurrentTick()<m_tmOutOfWater+0.5f) {
// no up/down change // no up/down change
vTranslation(2)=0; vTranslation(2)=0;
@ -4430,7 +4430,8 @@ functions:
void DeathActions(const CPlayerAction &paAction) { void DeathActions(const CPlayerAction &paAction) {
// set heading, pitch and banking from the normal rotation into the camera view rotation // set heading, pitch and banking from the normal rotation into the camera view rotation
if (m_penView!=NULL) { if (m_penView!=NULL) {
ASSERT(IsPredicted()&&m_penView->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_PositionVector = FLOAT3D(0, 1, 0);
en_plViewpoint.pl_OrientationAngle += (ANGLE3D( en_plViewpoint.pl_OrientationAngle += (ANGLE3D(
(ANGLE)((FLOAT)paAction.pa_aRotation(1)*_pTimer->TickQuantum), (ANGLE)((FLOAT)paAction.pa_aRotation(1)*_pTimer->TickQuantum),

View File

@ -1101,7 +1101,7 @@ functions:
} }
} }
// apply cannon draw // apply cannon draw
else if( (m_iCurrentWeapon == WEAPON_IRONCANNON) /*|| else if( m_iCurrentWeapon == WEAPON_IRONCANNON /*||
(m_iCurrentWeapon == WEAPON_NUKECANNON) */) (m_iCurrentWeapon == WEAPON_NUKECANNON) */)
{ {
FLOAT fLerpedMovement = Lerp(m_fWeaponDrawPowerOld, m_fWeaponDrawPower, _pTimer->GetLerpFactor()); FLOAT fLerpedMovement = Lerp(m_fWeaponDrawPowerOld, m_fWeaponDrawPower, _pTimer->GetLerpFactor());
@ -4008,7 +4008,7 @@ procedures:
GetAnimator()->FireAnimation(BODY_ANIM_SHOTGUN_FIRESHORT, AOF_LOOPING); GetAnimator()->FireAnimation(BODY_ANIM_SHOTGUN_FIRESHORT, AOF_LOOPING);
} else if (m_iCurrentWeapon==WEAPON_TOMMYGUN) { } else if (m_iCurrentWeapon==WEAPON_TOMMYGUN) {
autocall TommyGunStart() EEnd; 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(); jump CannonFireStart();
} }

View File

@ -246,7 +246,7 @@ void LastUnreadMessage(void)
// go to next/previous message // go to next/previous message
void PrevMessage(void) void PrevMessage(void)
{ {
if (_iActiveMessage<_acmMessages.Count()==0) { if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about?
return; return;
} }
_iActiveMessage--; _iActiveMessage--;
@ -258,7 +258,7 @@ void PrevMessage(void)
void NextMessage(void) void NextMessage(void)
{ {
if (_iActiveMessage<_acmMessages.Count()==0) { if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about?
return; return;
} }
_iActiveMessage++; _iActiveMessage++;
@ -305,7 +305,7 @@ void MessageTextUp(INDEX ctLines)
void MessageTextDn(INDEX ctLines) void MessageTextDn(INDEX ctLines)
{ {
// if no message do nothing // if no message do nothing
if (_iActiveMessage<_acmMessages.Count()==0) { if (_iActiveMessage < _acmMessages.Count()==0) { // FIXME: DG: what is this about?
return; return;
} }
// find text lines count // find text lines count
@ -874,7 +874,7 @@ static void ComputerOff(void)
static void ExitRequested(void) static void ExitRequested(void)
{ {
// if end of game // 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 in single player
if (GetSP()->sp_bSinglePlayer) { if (GetSP()->sp_bSinglePlayer) {
// request app to show high score // request app to show high score

View File

@ -1987,12 +1987,12 @@ static void MakeSplitDrawports(enum CGame::SplitScreenCfg ssc, INDEX iCount, CDr
} }
// if one player or observer with one screen // 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 // the only drawport covers entire screen
adpDrawPorts[0] = CDrawPort( pdp, 0.0, 0.0, 1.0, 1.0); adpDrawPorts[0] = CDrawPort( pdp, 0.0, 0.0, 1.0, 1.0);
apdpDrawPorts[0] = &adpDrawPorts[0]; apdpDrawPorts[0] = &adpDrawPorts[0];
// if two players or observer with two screens // 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 the drawport is not dualhead
if (!pdp->IsDualHead()) { if (!pdp->IsDualHead()) {
// need two drawports for filling the empty spaces left and right // 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]; apdpDrawPorts[1] = &adpDrawPorts[1];
} }
// if three players or observer with three screens // 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 the drawport is not dualhead
if (!pdp->IsDualHead()) { if (!pdp->IsDualHead()) {
// need two drawports for filling the empty spaces left and right // 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]; apdpDrawPorts[2] = &adpDrawPorts[2];
} }
// if four players or observer with four screens // 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 the drawport is not dualhead
if (!pdp->IsDualHead()) { if (!pdp->IsDualHead()) {
// first of four draw ports covers upper-left part of the screen // first of four draw ports covers upper-left part of the screen

View File

@ -76,7 +76,7 @@ class CButtonAction {
public: public:
// default constructor // default constructor
CButtonAction(); CButtonAction();
~CButtonAction() {} virtual ~CButtonAction() {}
CListNode ba_lnNode; CListNode ba_lnNode;
INDEX ba_iFirstKey; INDEX ba_iFirstKey;
BOOL ba_bFirstKeyDown; BOOL ba_bFirstKeyDown;

View File

@ -116,7 +116,7 @@ void CGame::QuickTest(const CTFileName &fnMapName,
// if it is not a mouse message // if it is not a mouse message
if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST)) { if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST)) {
// if not system key messages // 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)) { ||msg.message==WM_SYSKEYDOWN)) {
// dispatch it // dispatch it
TranslateMessage(&msg); TranslateMessage(&msg);

View File

@ -744,8 +744,8 @@ void DoGame(void)
// set flag if not in game // set flag if not in game
if( !_pGame->gm_bGameOn) _gmRunningGameMode = GM_NONE; if( !_pGame->gm_bGameOn) _gmRunningGameMode = GM_NONE;
if( _gmRunningGameMode==GM_DEMO && _pNetwork->IsDemoPlayFinished() if( (_gmRunningGameMode==GM_DEMO && _pNetwork->IsDemoPlayFinished())
||_gmRunningGameMode==GM_INTRO && _pNetwork->IsGameFinished()) { ||(_gmRunningGameMode==GM_INTRO && _pNetwork->IsGameFinished())) {
_pGame->StopGame(); _pGame->StopGame();
_gmRunningGameMode = GM_NONE; _gmRunningGameMode = GM_NONE;
@ -942,7 +942,7 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
// if it is not a mouse message // if it is not a mouse message
if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST) ) { if( !(msg.message>=WM_MOUSEFIRST && msg.message<=WM_MOUSELAST) ) {
// if not system key messages // 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)) { ||msg.message==WM_SYSKEYDOWN)) {
// dispatch it // dispatch it
TranslateMessage(&msg); TranslateMessage(&msg);
@ -1171,6 +1171,7 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
// if toggling console // if toggling console
BOOL bConsoleKey = sam_bToggleConsole || msg.message==WM_KEYDOWN && BOOL bConsoleKey = sam_bToggleConsole || msg.message==WM_KEYDOWN &&
// !!! FIXME: rcg11162001 This sucks. // !!! FIXME: rcg11162001 This sucks.
// FIXME: DG: we could use SDL_SCANCODE_GRAVE ?
#ifdef PLATFORM_UNIX #ifdef PLATFORM_UNIX
(msg.wParam == SDLK_BACKQUOTE (msg.wParam == SDLK_BACKQUOTE
#else #else