mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-28 21:05:53 +01:00
Fix several warnings, warn if not using depth buffer
Fixed -Wreorder warnings (hopefully the last?), also several potentially uninitialized variables. In SetupPixelFormat_OGL() Assert if gap_iDepthBits ends up being 0. Small adjustments to cmake warning settings for gcc/clang
This commit is contained in:
parent
c58328d881
commit
bee4102374
|
@ -112,11 +112,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
# TODO fix these warnings
|
||||
add_compile_options(-Wno-sign-compare)
|
||||
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-reorder)
|
||||
add_compile_options(-Wno-unused-but-set-variable)
|
||||
add_compile_options(-Wno-parentheses)
|
||||
MESSAGE(WARNING, "re-enable some of the warnings some day!")
|
||||
|
||||
|
@ -125,6 +124,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
add_compile_options(-Wno-tautological-undefined-compare)
|
||||
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
|
||||
endif()
|
||||
|
||||
if(MACOSX)
|
||||
|
|
|
@ -53,8 +53,8 @@ CBrushSector::CBrushSector(void)
|
|||
, bsc_ulFlags2(0)
|
||||
, bsc_ulTempFlags(0)
|
||||
, bsc_ulVisFlags(0)
|
||||
, bsc_strName("")
|
||||
, bsc_bspBSPTree(*new DOUBLEbsptree3D)
|
||||
, bsc_strName("")
|
||||
{
|
||||
|
||||
};
|
||||
|
@ -622,9 +622,9 @@ void CBrushSector::TriangularizeMarkedPolygons( void)
|
|||
bpoNew.bpo_abpePolygonEdges[2].bpe_pbedEdge = &abedEdgesNew[iEdge+2];
|
||||
bpoNew.bpo_abpePolygonEdges[2].bpe_bReverse = FALSE;
|
||||
|
||||
CBrushEdge &edg0 = *bpoNew.bpo_abpePolygonEdges[0].bpe_pbedEdge;
|
||||
CBrushEdge &edg1 = *bpoNew.bpo_abpePolygonEdges[1].bpe_pbedEdge;
|
||||
CBrushEdge &edg2 = *bpoNew.bpo_abpePolygonEdges[2].bpe_pbedEdge;
|
||||
//CBrushEdge &edg0 = *bpoNew.bpo_abpePolygonEdges[0].bpe_pbedEdge;
|
||||
//CBrushEdge &edg1 = *bpoNew.bpo_abpePolygonEdges[1].bpe_pbedEdge;
|
||||
//CBrushEdge &edg2 = *bpoNew.bpo_abpePolygonEdges[2].bpe_pbedEdge;
|
||||
|
||||
// set brush vertex ptrs
|
||||
bpoNew.bpo_apbvxTriangleVertices.New(3);
|
||||
|
|
|
@ -89,13 +89,16 @@ void *CGfxLibrary::OGL_GetProcAddress(const char *procname)
|
|||
// prepares pixel format for OpenGL context
|
||||
BOOL CGfxLibrary::SetupPixelFormat_OGL( HDC hdc, BOOL bReport/*=FALSE*/)
|
||||
{
|
||||
SDL_Window *window = (SDL_Window *) hdc;
|
||||
//SDL_Window *window = (SDL_Window *) hdc;
|
||||
const DisplayDepth dd = gl_dmCurrentDisplayMode.dm_ddDepth;
|
||||
|
||||
// clamp depth/stencil values
|
||||
extern INDEX gap_iDepthBits;
|
||||
extern INDEX gap_iStencilBits;
|
||||
if( gap_iDepthBits <12) gap_iDepthBits = 0;
|
||||
if( gap_iDepthBits <12) {
|
||||
ASSERT(gap_iDepthBits >= 12 && "Using gap_iDepthBits=0, that's probably bad?!");
|
||||
gap_iDepthBits = 0;
|
||||
}
|
||||
else if( gap_iDepthBits <22) gap_iDepthBits = 16;
|
||||
else if( gap_iDepthBits <28) gap_iDepthBits = 24;
|
||||
else gap_iDepthBits = 32;
|
||||
|
|
|
@ -254,7 +254,7 @@ void CObjectPolygonEdge::GetVertices(CObjectVertex *&povxStart, CObjectVertex *&
|
|||
* Default constructor.
|
||||
*/
|
||||
CObjectSector::CObjectSector(void) :
|
||||
osc_colAmbient(0), osc_colColor(0), osc_strName("")
|
||||
osc_colColor(0), osc_colAmbient(0), osc_strName("")
|
||||
{
|
||||
osc_ulFlags[0] = 0;
|
||||
osc_ulFlags[1] = 0;
|
||||
|
|
|
@ -629,7 +629,7 @@ void CCommunicationInterface::Broadcast_Update_t() {
|
|||
BOOL bIsAlready;
|
||||
BOOL bFoundEmpty;
|
||||
ULONG iClient;
|
||||
UBYTE ubDummy=65;
|
||||
//UBYTE ubDummy=65;
|
||||
|
||||
|
||||
// while there is a connection request packet in the input buffer
|
||||
|
@ -1080,7 +1080,8 @@ void CCommunicationInterface::Client_OpenNet_t(ULONG ulServerAddress)
|
|||
if (cm_ciLocalClient.ci_pbReliableInputBuffer.pb_ulNumOfPackets > 0) {
|
||||
ppaReadPacket = cm_ciLocalClient.ci_pbReliableInputBuffer.GetFirstPacket();
|
||||
// and it is a connection confirmation
|
||||
if (ppaReadPacket->pa_ubReliable && UDP_PACKET_CONNECT_RESPONSE) {
|
||||
// DG: replaced && with & as done everywhere else, hope this doesn't rely on being buggy.
|
||||
if (ppaReadPacket->pa_ubReliable & UDP_PACKET_CONNECT_RESPONSE) {
|
||||
// the client has succedeed to connect, so read the uwID from the packet
|
||||
cm_ciLocalClient.ci_adrAddress.adr_ulAddress = ulServerAddress;
|
||||
cm_ciLocalClient.ci_adrAddress.adr_uwPort = net_iPort;
|
||||
|
|
|
@ -676,11 +676,11 @@ void CNetworkTimerHandler::HandleTimer(void)
|
|||
*/
|
||||
CNetworkLibrary::CNetworkLibrary(void) :
|
||||
ga_IsServer(FALSE), // is not server
|
||||
ga_srvServer(*new CServer),
|
||||
ga_sesSessionState(*new CSessionState),
|
||||
ga_bDemoRec(FALSE), // not recording demo
|
||||
ga_bDemoPlay(FALSE), // not playing demo
|
||||
ga_bDemoPlayFinished(FALSE), // demo not finished
|
||||
ga_srvServer(*new CServer),
|
||||
ga_sesSessionState(*new CSessionState)
|
||||
ga_bDemoPlayFinished(FALSE) // demo not finished
|
||||
{
|
||||
ga_aplsPlayers.New(NET_MAXLOCALPLAYERS);
|
||||
|
||||
|
|
|
@ -416,9 +416,9 @@ template<class Type, int iDimensions>
|
|||
BSPNode<Type, iDimensions>::BSPNode(const Plane<Type, iDimensions> &plSplitPlane, size_t ulPlaneTag,
|
||||
BSPNode<Type, iDimensions> &bnFront, BSPNode<Type, iDimensions> &bnBack)
|
||||
: Plane<Type, iDimensions>(plSplitPlane)
|
||||
, bn_bnlLocation(BNL_BRANCH)
|
||||
, bn_pbnFront(&bnFront)
|
||||
, bn_pbnBack(&bnBack)
|
||||
, bn_bnlLocation(BNL_BRANCH)
|
||||
, bn_ulPlaneTag(ulPlaneTag)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -84,12 +84,12 @@ CTextureBlending::CTextureBlending(void)
|
|||
* Constructor.
|
||||
*/
|
||||
CWorld::CWorld(void)
|
||||
: wo_colBackground(C_lGRAY) // clear background color
|
||||
, wo_pecWorldBaseClass(NULL) // worldbase class must be obtained before using the world
|
||||
, wo_bPortalLinksUpToDate(FALSE) // portal-sector links must be updated
|
||||
: wo_pecWorldBaseClass(NULL) // worldbase class must be obtained before using the world
|
||||
, wo_baBrushes(*new CBrushArchive)
|
||||
, wo_taTerrains(*new CTerrainArchive)
|
||||
, wo_colBackground(C_lGRAY) // clear background color
|
||||
, wo_ulSpawnFlags(0)
|
||||
, wo_bPortalLinksUpToDate(FALSE) // portal-sector links must be updated
|
||||
{
|
||||
wo_baBrushes.ba_pwoWorld = this;
|
||||
wo_taTerrains.ta_pwoWorld = this;
|
||||
|
|
|
@ -273,7 +273,7 @@ functions:
|
|||
// triggers
|
||||
if (fHealth<=fOldHealth && fHealth>fNewHealth)
|
||||
{
|
||||
if (&*penTrigger[i]) {
|
||||
if (penTrigger[i].ep_pen != NULL) {
|
||||
SendToTarget(&*penTrigger[i], EET_TRIGGER, FixupCausedToPlayer(this, m_penEnemy));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -469,6 +469,7 @@ functions:
|
|||
default: iAnim = ELEMENTALLAVA_ANIM_WOUND03; break;
|
||||
}
|
||||
} else {
|
||||
iAnim=0; // DG: not sure this makes sense, but at least it has a deterministic value
|
||||
/* switch (IRnd()%3) {
|
||||
case 0: iAnim = STONEMAN_ANIM_WOUND01; break;
|
||||
case 1: iAnim = STONEMAN_ANIM_WOUND02; break;
|
||||
|
@ -538,6 +539,7 @@ functions:
|
|||
if (m_EetType == ELT_LAVA) {
|
||||
iAnim = ELEMENTALLAVA_ANIM_DEATH03;
|
||||
} else {
|
||||
iAnim = 0; // DG: set to deterministic value
|
||||
// iAnim = STONEMAN_ANIM_DEATH03;
|
||||
}
|
||||
StartModelAnim(iAnim, 0);
|
||||
|
@ -1265,6 +1267,7 @@ procedures:
|
|||
if (m_EetType == ELT_LAVA) {
|
||||
iAnim = ELEMENTALLAVA_ANIM_MELTUP;
|
||||
} else {
|
||||
iAnim = 0; // DG: initialize to deterministic value
|
||||
// iAnim = STONEMAN_ANIM_MORPHPLANEUP;
|
||||
}
|
||||
StartModelAnim(iAnim, 0);
|
||||
|
|
|
@ -3531,7 +3531,7 @@ procedures:
|
|||
// ignore twister
|
||||
bHit &= !IsOfClass(epass.penOther, "Twister");
|
||||
if (epass.penOther!=m_penLauncher) {
|
||||
bHit = bHit ;
|
||||
// bHit = bHit ; // FIXME: DG: what was this supposed to achieve?
|
||||
}
|
||||
if (bHit) {
|
||||
ProjectileTouch(epass.penOther);
|
||||
|
|
|
@ -619,6 +619,7 @@ functions:
|
|||
iCount = IRnd()%m_iGroup03Count+1;
|
||||
} else {
|
||||
ASSERT("Invalid group!");
|
||||
iCount = 0; // DG: this should have a deterministic value in case this happens after all!
|
||||
}
|
||||
ASSERT(iCount>0);
|
||||
|
||||
|
|
|
@ -687,6 +687,12 @@ void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi)
|
|||
colText = 0xc87832ff;
|
||||
}
|
||||
}
|
||||
else // DG: make sure iPosX/Y is initialized
|
||||
{
|
||||
// no idea if 0 makes sense, but at least it's deterministic
|
||||
iPosX = 0;
|
||||
iPosY = 0;
|
||||
}
|
||||
|
||||
PIX pixhtcx = (PIX) (pixC1S+iPosX*fStretch);
|
||||
PIX pixhtcy = (PIX) (pixR1S+iPosY*fStretch);
|
||||
|
|
Loading…
Reference in New Issue
Block a user