diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h index c97379e048e..04b7309ee6b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h @@ -55,7 +55,7 @@ class W3DDebugIcons : public RenderObjClass virtual bool Cast_Ray(RayCollisionTestClass & raytest); virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; protected: VertexMaterialClass *m_vertexMaterialClass; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h index 9372d69136f..b4366356110 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h @@ -59,14 +59,14 @@ class W3DDisplay : public Display virtual ~W3DDisplay() override; virtual void init() override; ///< initialize or re-initialize the system - virtual void reset() override; ///< Reset system + virtual void reset() override; ///< Reset system virtual void setWidth( UnsignedInt width ) override; virtual void setHeight( UnsignedInt height ) override; virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ) override; virtual Int getDisplayModeCount() override; ///winGetDisabledTextBorderColor(); // draw the text - if( !(tData->text && (textColor != WIN_COLOR_UNDEFINED)) ) + if( !(tData->text && (textColor != WIN_COLOR_UNDEFINED)) ) return; DisplayString *text = tData->text; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp index 39c989c585d..40cf3b98a76 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp @@ -79,7 +79,7 @@ void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) Int progress = (Int)window->winGetUserData(); // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); + window->winGetScreenPosition( &origin.x, &origin.y ); window->winGetSize( &size.x, &size.y ); // get the right colors to use @@ -190,7 +190,7 @@ void W3DGadgetProgressBarImageDrawA( GameWindow *window, WinInstanceData *instDa Int xOffset, yOffset; Int i; // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); + window->winGetScreenPosition( &origin.x, &origin.y ); window->winGetSize( &size.x, &size.y ); // get offset @@ -234,7 +234,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat Int i; // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); + window->winGetScreenPosition( &origin.x, &origin.y ); window->winGetSize( &size.x, &size.y ); // get offset @@ -385,7 +385,7 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat barWindowSize.y = size.y; pieces = barWindowSize.x / barCenter->getImageWidth(); - // draw the pieces + // draw the pieces start.x = origin.x +10; start.y = origin.y + yOffset +5; end.y = start.y + size.y - 10; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp index 2b89eb1e564..fe579b5087a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp @@ -473,11 +473,11 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, TheDisplay->drawImage( hilitedOverlayIcon, start.x, start.y, start.x + size.x, start.y + size.y ); } } - else if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - //The button appears to be pushed -- CHECK_LIKE buttons that are on. - TheDisplay->drawImage( pushedOverlayIcon, start.x, start.y, start.x + size.x, start.y + size.y ); - } + else if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) + { + //The button appears to be pushed -- CHECK_LIKE buttons that are on. + TheDisplay->drawImage( pushedOverlayIcon, start.x, start.y, start.x + size.x, start.y + size.y ); + } } } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index 8640566cccb..60eed0a4d46 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -203,7 +203,7 @@ void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ) } // draw the text - if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) + if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) drawStaticTextText( window, instData, textColor, textOutlineColor ); @@ -255,7 +255,7 @@ void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData } // draw the text - if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) + if( tData->text && (textColor != WIN_COLOR_UNDEFINED) ) drawStaticTextText( window, instData, textColor, textOutlineColor ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 4d12971edb7..8a4372cc5b4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -245,7 +245,7 @@ typedef struct _NeighborEdge Short neighborIndex; // index of polygon who is our neighbor, if there is // not a neighbor it contains NO_NEIGHBOR Short neighborEdgeIndex[ 2 ]; // the two vertex indices that represent the - // shared edge + // shared edge } NeighborEdge; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp index 041bd5afe7b..1afc2c8da82 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp @@ -241,10 +241,10 @@ void W3DCustomEdging::loadEdgingsInVertexAndIndexBuffers(WorldHeightMap *pMap, I #ifdef FLIP_TRIANGLES // jba - reduces "diamonding" in some cases, not others. Better cliffs, though. if (flipForBlend) { *curIb++ = startVertex + 1; - *curIb++ = startVertex + yOffset; + *curIb++ = startVertex + yOffset; *curIb++ = startVertex ; - *curIb++ = startVertex + 1; - *curIb++ = startVertex + 1+yOffset; + *curIb++ = startVertex + 1; + *curIb++ = startVertex + 1+yOffset; *curIb++ = startVertex + yOffset; } else diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp index f41be9aa6bf..aba5d376745 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp @@ -245,7 +245,7 @@ void W3DDebugIcons::Render(RenderInfoClass & rinfo) UnsignedShort *curIb = ib; // VertexFormatXYZNDUV2 *curVb = vb; - Real shadeR, shadeG, shadeB; + Real shadeR, shadeG, shadeB; shadeR = 0; shadeG = 0; shadeB = 255; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 6a17841b0fa..c05fda2c0f3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -190,25 +190,25 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) } - Bool beBrief = brief & s_notFirstDump; - s_notFirstDump = TRUE; + Bool beBrief = brief & s_notFirstDump; + s_notFirstDump = TRUE; fprintf( m_fp, "----------------------------------------------------------------\n" ); fprintf( m_fp, "Performance Statistical Dump -- Frame %d\n", TheGameLogic->getFrame() ); - if ( ! beBrief ) - { - //static char buf[1024]; - fprintf( m_fp, "Time:\t%s", getCurrentTimeString() ); - fprintf( m_fp, "Map:\t%s\n", TheGlobalData->m_mapName.str()); - fprintf( m_fp, "Side:\t%s\n", ThePlayerList->getLocalPlayer()->getSide().str()); - fprintf( m_fp, "----------------------------------------------------------------\n" ); - } + if ( ! beBrief ) + { + //static char buf[1024]; + fprintf( m_fp, "Time:\t%s", getCurrentTimeString() ); + fprintf( m_fp, "Map:\t%s\n", TheGlobalData->m_mapName.str()); + fprintf( m_fp, "Side:\t%s\n", ThePlayerList->getLocalPlayer()->getSide().str()); + fprintf( m_fp, "----------------------------------------------------------------\n" ); + } //FPS Real fps = TheDisplay->getAverageFPS(); fprintf( m_fp, "Average FPS: %.1f (%.5f msec)\n", fps, 1000.0f / fps ); - if ( flagSpikes && fps<20.0f ) - fprintf( m_fp, " FPS OUT OF TOLERANCE\n" ); + if ( flagSpikes && fps<20.0f ) + fprintf( m_fp, " FPS OUT OF TOLERANCE\n" ); //Rendering stats @@ -218,23 +218,23 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) Int onScreenParticleCount = TheParticleSystemManager->getOnScreenParticleCount(); - if ( flagSpikes ) - { - if ( Debug_Statistics::Get_Draw_Calls()>2000 ) - fprintf( m_fp, " DRAWS OUT OF TOLERANCE(2000)\n" ); - if ( Debug_Statistics::Get_Sorting_Polygons() > (onScreenParticleCount*2) + 300 ) - fprintf( m_fp, " NON-PARTICLE-SORTS OUT OF TOLERANCE(300)\n" ); - if ( Debug_Statistics::Get_DX8_Skin_Renders()>100 ) - fprintf( m_fp, " SKINS OUT OF TOLERANCE(100)\n" ); - } + if ( flagSpikes ) + { + if ( Debug_Statistics::Get_Draw_Calls()>2000 ) + fprintf( m_fp, " DRAWS OUT OF TOLERANCE(2000)\n" ); + if ( Debug_Statistics::Get_Sorting_Polygons() > (onScreenParticleCount*2) + 300 ) + fprintf( m_fp, " NON-PARTICLE-SORTS OUT OF TOLERANCE(300)\n" ); + if ( Debug_Statistics::Get_DX8_Skin_Renders()>100 ) + fprintf( m_fp, " SKINS OUT OF TOLERANCE(100)\n" ); + } //Object stats UnsignedInt objCount = TheGameLogic->getObjectCount(); UnsignedInt objScreenCount = TheGameClient->getRenderedObjectCount(); fprintf( m_fp, "Objects: %d in world (%d onscreen)\n", objCount, objScreenCount ); - if ( flagSpikes && objCount > 800 ) - fprintf( m_fp, " OBJS OUT OF TOLERANCE(800)\n" ); + if ( flagSpikes && objCount > 800 ) + fprintf( m_fp, " OBJS OUT OF TOLERANCE(800)\n" ); //AI stats UnsignedInt numAI, numMoving, numAttacking, numWaitingForPath, overallFailedPathfinds; @@ -246,8 +246,8 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) fprintf( m_fp, " -attacking: %d\n", numAttacking ); fprintf( m_fp, " -waiting for path: %d\n", numWaitingForPath ); fprintf( m_fp, " Total failed pathfinds: %d\n", overallFailedPathfinds ); - if ( flagSpikes && overallFailedPathfinds > 0 ) - fprintf( m_fp, " FAILEDPATHFINDS OUT OF TOLERANCE(0)\n" ); + if ( flagSpikes && overallFailedPathfinds > 0 ) + fprintf( m_fp, " FAILEDPATHFINDS OUT OF TOLERANCE(0)\n" ); fprintf( m_fp, "\n" ); // Script stats @@ -258,8 +258,8 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) fprintf( m_fp, " Total time last frame: %.5f msec\n", timeLastFrame*1000 ); fprintf( m_fp, " -Slowest 2 scripts %s\n", slowScripts.str() ); fprintf( m_fp, " -Slowest 2 script times %.5f msec, %.5f msec \n", slowScript1*1000, slowScript2*1000 ); - if ( flagSpikes && slowScript1*1000 > 0.2f || slowScript2*1000 > 0.2f ) - fprintf( m_fp, " SLOW SCRIPT OUT OF TOLERANCE(0.2)\n" ); + if ( flagSpikes && slowScript1*1000 > 0.2f || slowScript2*1000 > 0.2f ) + fprintf( m_fp, " SLOW SCRIPT OUT OF TOLERANCE(0.2)\n" ); fprintf( m_fp, "\n" ); @@ -281,10 +281,10 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) Int totalParticles = TheParticleSystemManager->getParticleCount(); fprintf( m_fp, " Particles: %d in world (%d onscreen)\n", totalParticles, onScreenParticleCount ); - if ( flagSpikes && totalParticles > TheGlobalData->m_maxParticleCount - 10 ) - fprintf( m_fp, " PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); - if ( flagSpikes && onScreenParticleCount > TheGlobalData->m_maxParticleCount - 10 ) - fprintf( m_fp, " ON_SCREEN_PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); + if ( flagSpikes && totalParticles > TheGlobalData->m_maxParticleCount - 10 ) + fprintf( m_fp, " PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); + if ( flagSpikes && onScreenParticleCount > TheGlobalData->m_maxParticleCount - 10 ) + fprintf( m_fp, " ON_SCREEN_PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); // polygons this frame @@ -303,19 +303,19 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) // terrain stats fprintf( m_fp, " 3-Way Blends: %d/%d, \n Shoreline Blends: %d/%d\n", TheTerrainRenderObject->getNumExtraBlendTiles(TRUE),TheTerrainRenderObject->getNumExtraBlendTiles(FALSE), TheTerrainRenderObject->getNumShoreLineTiles(TRUE),TheTerrainRenderObject->getNumShoreLineTiles(FALSE)); - if ( flagSpikes && TheTerrainRenderObject->getNumExtraBlendTiles(TRUE) > 2000 ) - fprintf( m_fp, " 3-WAYS OUT OF TOLERANCE(2000)\n" ); - if ( flagSpikes && TheTerrainRenderObject->getNumShoreLineTiles(TRUE) > 2000 ) - fprintf( m_fp, " SHORELINES OUT OF TOLERANCE(2000)\n" ); + if ( flagSpikes && TheTerrainRenderObject->getNumExtraBlendTiles(TRUE) > 2000 ) + fprintf( m_fp, " 3-WAYS OUT OF TOLERANCE(2000)\n" ); + if ( flagSpikes && TheTerrainRenderObject->getNumShoreLineTiles(TRUE) > 2000 ) + fprintf( m_fp, " SHORELINES OUT OF TOLERANCE(2000)\n" ); fprintf( m_fp, "\n" ); #if defined(RTS_DEBUG) - if ( ! beBrief ) - { - TheAudio->audioDebugDisplay( nullptr, nullptr, m_fp ); - fprintf( m_fp, "\n" ); - } + if ( ! beBrief ) + { + TheAudio->audioDebugDisplay( nullptr, nullptr, m_fp ); + fprintf( m_fp, "\n" ); + } #endif #ifdef MEMORYPOOL_DEBUG @@ -328,12 +328,12 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) fprintf( m_fp, "%s", TheSubsystemList->dumpTimesForAll().str()); - if ( ! beBrief ) - { - fprintf( m_fp, "----------------------------------------------------------------\n" ); - fprintf( m_fp, "END -- Frame %d\n", TheGameLogic->getFrame() ); - fprintf( m_fp, "----------------------------------------------------------------\n" ); - } + if ( ! beBrief ) + { + fprintf( m_fp, "----------------------------------------------------------------\n" ); + fprintf( m_fp, "END -- Frame %d\n", TheGameLogic->getFrame() ); + fprintf( m_fp, "----------------------------------------------------------------\n" ); + } fprintf( m_fp, "\n\n" ); fflush(m_fp); } @@ -972,7 +972,7 @@ void W3DDisplay::gatherDebugStats() } ++s_framesRenderedSinceLastUpdate; - s_drawCallsSinceLastUpdate += Debug_Statistics::Get_Draw_Calls(); + s_drawCallsSinceLastUpdate += Debug_Statistics::Get_Draw_Calls(); s_sortedPolysSinceLastUpdate += Debug_Statistics::Get_Sorting_Polygons(); Int64 freq64 = getPerformanceCounterFrequency(); @@ -1164,7 +1164,7 @@ void W3DDisplay::gatherDebugStats() } } } - if (pListFile) { + if (pListFile) { fprintf(pListFile, "\nFPS: %.2f, %.2fms\n", fps, ms); fflush(pListFile); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 12c7c8dbeeb..bfad84124c5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -391,6 +391,6 @@ void W3DDisplayString::setUseHotkey( Bool useHotkey, Color hotKeyColor ) void W3DDisplayString::setWordWrapCentered( Bool isCentered ) { // set the Word Wrap - if( m_textRenderer.Set_Word_Wrap_Centered(isCentered) ) + if( m_textRenderer.Set_Word_Wrap_Centered(isCentered) ) notifyTextChanged(); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 34d1c0e0046..6a736c63fdc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -83,9 +83,9 @@ void W3DDisplayStringManager::postProcessLoad() { m_groupNumeralStrings[i] = newDisplayString(); m_groupNumeralStrings[i]->setFont(font); - AsciiString displayNumber; - displayNumber.format("NUMBER:%d", i); - m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); + AsciiString displayNumber; + displayNumber.format("NUMBER:%d", i); + m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); } m_formationLetterDisplayString = newDisplayString(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index 8fd63a0c3fd..a4e101ba06c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -75,7 +75,7 @@ class DebugHintObject : public RenderObjClass virtual Bool Cast_Ray(RayCollisionTestClass & raytest); virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; int updateBlock(); void freeMapResources(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index b1b792b3ac9..37d099c8c6a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -115,14 +115,14 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) /// @todo lorenzen sez: this should be debug only: m_onScreenParticleCount = 0; - const FrustumClass & frustum = rinfo.Camera.Get_Frustum(); + const FrustumClass & frustum = rinfo.Camera.Get_Frustum(); AABoxClass bbox; //Get a bounding box around our visible universe. Bounded by terrain and the sky //so much tighter fitting volume than what's actually visible. This will cull //particles falling under the ground. - TheTerrainRenderObject->getMaximumVisibleBox(frustum, &bbox, TRUE); + TheTerrainRenderObject->getMaximumVisibleBox(frustum, &bbox, TRUE); //@todo lorenzen sez: put these in registers for sure Real bcX = bbox.Center.X; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index 37bacee4a77..7c2f977c402 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -158,7 +158,7 @@ RoadType::~RoadType() //============================================================================= void RoadType::applyTexture() { - W3DShaderManager::setTexture(0,m_roadTexture); + W3DShaderManager::setTexture(0,m_roadTexture); DX8Wrapper::Set_Index_Buffer(m_indexRoad,0); DX8Wrapper::Set_Vertex_Buffer(m_vertexRoad); } @@ -544,9 +544,9 @@ void W3DRoadBuffer::loadFloatSection(RoadSegment *pRoad, Vector2 loc, corners[bottomRight] = corners[bottomLeft]; corners[bottomRight] += roadVector; corners[topRight] = corners[bottomRight]; - corners[topRight] += 2*roadNormal; + corners[topRight] += 2*roadNormal; corners[topLeft] = corners[bottomLeft]; - corners[topLeft] += 2*roadNormal; + corners[topLeft] += 2*roadNormal; loadFloat4PtSection(pRoad, loc, roadNormal, roadVector, corners, uOffset, vOffset, scale, scale); @@ -978,7 +978,7 @@ void W3DRoadBuffer::loadLit4PtSection(RoadSegment *pRoad, UnsignedShort *ib, Ver shadeB += factor*ambient.Z; } } - if (shadeR > 1.0) shadeR = 1.0; + if (shadeR > 1.0) shadeR = 1.0; if(shadeR < 0.0f) shadeR = 0.0f; if (shadeG > 1.0) shadeG = 1.0; if(shadeG < 0.0f) shadeG = 0.0f; @@ -1086,9 +1086,9 @@ void W3DRoadBuffer::loadCurve(RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Re corners[bottomRight] = corners[bottomLeft]; corners[bottomRight] += roadVector; corners[topRight] = corners[bottomRight]; - corners[topRight] += 2*roadNormal; + corners[topRight] += 2*roadNormal; corners[topLeft] = corners[bottomLeft]; - corners[topLeft] += 2*roadNormal; + corners[topLeft] += 2*roadNormal; // Tweak a little if (pRoad->m_curveRadius == TIGHT_CORNER_RADIUS) { @@ -1096,9 +1096,9 @@ void W3DRoadBuffer::loadCurve(RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Re corners[bottomRight] = corners[bottomLeft]; corners[bottomRight] += roadVector*0.5f; corners[topRight] = corners[bottomRight]; - corners[topRight] += 2*roadNormal; + corners[topRight] += 2*roadNormal; corners[topLeft] = corners[bottomLeft]; - corners[topLeft] += 2*roadNormal; + corners[topLeft] += 2*roadNormal; corners[bottomRight] += roadVector*0.1f; corners[bottomRight] += roadNormal*0.2f; @@ -1113,9 +1113,9 @@ void W3DRoadBuffer::loadCurve(RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Re corners[bottomRight] = corners[bottomLeft]; corners[bottomRight] += roadVector; corners[topRight] = corners[bottomRight]; - corners[topRight] += 2*roadNormal; + corners[topRight] += 2*roadNormal; corners[topLeft] = corners[bottomLeft]; - corners[topLeft] += 2*roadNormal; + corners[topLeft] += 2*roadNormal; corners[bottomRight] += roadVector*0.1f; corners[bottomRight] += roadNormal*0.4f; @@ -1510,7 +1510,7 @@ void W3DRoadBuffer::addMapObject(RoadSegment *pRoad, Bool updateTheCounts) Vector2 loc1, loc2; loc1 = cur.m_pt1.loc; loc2 = cur.m_pt2.loc; - Vector2 roadVector(loc2.X-loc1.X, loc2.Y-loc1.Y); + Vector2 roadVector(loc2.X-loc1.X, loc2.Y-loc1.Y); Vector2 roadNormal(-roadVector.Y, roadVector.X); roadNormal.Normalize(); roadNormal *= (cur.m_scale*cur.m_widthInTexture/2.0f); @@ -2893,8 +2893,8 @@ void W3DRoadBuffer::insertCurveSegmentAt(Int ndx1, Int ndx2) pr2 = &m_roads[ndx2].m_pt1.loc; pr1 = &m_roads[ndx2].m_pt2.loc; turnRight = false; - line1.Set(Vector3(pr1->X, pr1->Y, 0), Vector3(pr2->X, pr2->Y, 0)); - line2.Set(Vector3(pr3->X, pr3->Y, 0), Vector3(pr4->X, pr4->Y, 0)); + line1.Set(Vector3(pr1->X, pr1->Y, 0), Vector3(pr2->X, pr2->Y, 0)); + line2.Set(Vector3(pr3->X, pr3->Y, 0), Vector3(pr4->X, pr4->Y, 0)); } Real angle = WWMath::Acos(curSin); Real count = angle / (PI/6.0f); // number of 30 degree steps. @@ -3009,14 +3009,14 @@ void W3DRoadBuffer::insertCurveSegmentAt(Int ndx1, Int ndx2) } // Recalculate top & bottom. - Vector2 roadVector = m_roads[ndx1].m_pt2.loc - m_roads[ndx1].m_pt1.loc; + Vector2 roadVector = m_roads[ndx1].m_pt2.loc - m_roads[ndx1].m_pt1.loc; Vector2 roadNormal(-roadVector.Y, roadVector.X); roadNormal.Normalize(); roadNormal *= (m_roads[ndx1].m_scale*m_roads[ndx1].m_widthInTexture/2.0f); m_roads[ndx1].m_pt1.top = m_roads[ndx1].m_pt1.loc+roadNormal; m_roads[ndx1].m_pt1.bottom = m_roads[ndx1].m_pt1.loc - roadNormal; - roadVector = m_roads[ndx2].m_pt2.loc - m_roads[ndx2].m_pt1.loc; + roadVector = m_roads[ndx2].m_pt2.loc - m_roads[ndx2].m_pt1.loc; roadNormal = Vector2(-roadVector.Y, roadVector.X); roadNormal.Normalize(); roadNormal *= (m_roads[ndx2].m_scale*m_roads[ndx2].m_widthInTexture/2.0f); @@ -3307,7 +3307,7 @@ void W3DRoadBuffer::drawRoads(CameraClass * camera, TextureClass *cloudTexture, st=W3DShaderManager::ST_ROAD_BASE_NOISE2; Int devicePasses = 1; //assume regular rendering - //Find number of passes required to render current shader + //Find number of passes required to render current shader devicePasses=W3DShaderManager::getShaderPasses(st); W3DShaderManager::setTexture(1,cloudTexture); //cloud @@ -3343,7 +3343,7 @@ void W3DRoadBuffer::drawRoads(CameraClass * camera, TextureClass *cloudTexture, for (Int pass=0; pass < devicePasses; pass++) { if (!wireframe) - W3DShaderManager::setShader(st, pass); + W3DShaderManager::setShader(st, pass); //Draw all this road type. DX8Wrapper::Draw_Triangles( 0, m_roadTypes[i].getNumIndices()/3, 0, m_roadTypes[i].getNumVertices()); #ifdef LOG_STATS @@ -3352,7 +3352,7 @@ void W3DRoadBuffer::drawRoads(CameraClass * camera, TextureClass *cloudTexture, } if (!wireframe) //shader was applied at least once? - W3DShaderManager::resetShader(st); + W3DShaderManager::resetShader(st); } } #ifdef LOG_STATS diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index d22790fd6d7..d1ff768af79 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -474,13 +474,13 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) if (draw->isDrawableEffectivelyHidden() || draw->getFullyObscuredByShroud()) { isVisible = FALSE; - robj->Set_Visible(isVisible); - } + robj->Set_Visible(isVisible); + } //assume normal rendering. drawInfo->m_flags = DrawableInfo::ERF_IS_NORMAL; //clear any rendering flags that may be in effect. - if ( ! isVisible ) - continue; + if ( ! isVisible ) + continue; if (draw->getEffectiveOpacity() != 1.0f && m_translucentObjectsCount < TheGlobalData->m_maxVisibleTranslucentObjects) { @@ -533,7 +533,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) } } - Visibility_Checked = true; + Visibility_Checked = true; } //============================================================================ @@ -639,8 +639,8 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I ss = OBJECTSHROUD_PARTIAL_CLEAR; } } - if (!robj->Peek_Scene()) - return; //this object was removed by the getShroudedStatus() call. + if (!robj->Peek_Scene()) + return; //this object was removed by the getShroudedStatus() call. } else { @@ -716,23 +716,23 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I { rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); - //if ( draw->testTintStatus( TINT_STATUS_FRENZY ) ) - //{ + //if ( draw->testTintStatus( TINT_STATUS_FRENZY ) ) + //{ // rinfo.Push_Material_Pass(m_heatVisionMaterialPass); - //} + //} //else - if (draw->getStealthLook() == STEALTHLOOK_VISIBLE_DETECTED ) + if (draw->getStealthLook() == STEALTHLOOK_VISIBLE_DETECTED ) { - rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); + rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); // THIS WILL EXPLICITLY SKIP THE FIRST PASS SO THAT HEATVISION ONLY WILL RENDER rinfo.Push_Override_Flags(RenderInfoClass::RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY); rinfo.Push_Material_Pass(m_heatVisionOnlyPass); - doExtraFlagsPop = TRUE; + doExtraFlagsPop = TRUE; } else { //THIS CALLS FOR THE HEATVISION TO RENDER - rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); + rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); rinfo.Push_Material_Pass(m_heatVisionMaterialPass); } @@ -777,23 +777,23 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I } } - if( draw && draw->getReceivesDynamicLights() ) - { - // dynamic lights - RefRenderObjListIterator dynaLightIt(&m_dynamicLightList); - for (dynaLightIt.First(); !dynaLightIt.Is_Done(); dynaLightIt.Next()) - { - W3DDynamicLight* pDyna = (W3DDynamicLight*)dynaLightIt.Peek_Obj(); - if (!pDyna->isEnabled()) { - continue; - } - SphereClass lSph = pDyna->Get_Bounding_Sphere(); - if (pDyna->Get_Type() == LightClass::POINT && !Spheres_Intersect(sph, lSph)) { - continue; - } - lightEnv.Add_Light(*(LightClass*)dynaLightIt.Peek_Obj()); - } - } + if( draw && draw->getReceivesDynamicLights() ) + { + // dynamic lights + RefRenderObjListIterator dynaLightIt(&m_dynamicLightList); + for (dynaLightIt.First(); !dynaLightIt.Is_Done(); dynaLightIt.Next()) + { + W3DDynamicLight* pDyna = (W3DDynamicLight*)dynaLightIt.Peek_Obj(); + if (!pDyna->isEnabled()) { + continue; + } + SphereClass lSph = pDyna->Get_Bounding_Sphere(); + if (pDyna->Get_Type() == LightClass::POINT && !Spheres_Intersect(sph, lSph)) { + continue; + } + lightEnv.Add_Light(*(LightClass*)dynaLightIt.Peek_Obj()); + } + } lightEnv.Pre_Render_Update(rinfo.Camera.Get_Transform()); rinfo.light_environment = &lightEnv; @@ -916,11 +916,11 @@ void RTS3DScene::updateFixedLightEnvironments(RenderInfoClass & rinfo) m_globalLight[globalLightIndex]->Get_Diffuse(&oldDiffuse); m_globalLight[globalLightIndex]->Get_Ambient(&oldAmbient); - oldDiffuse *= infantryLightScale; - oldAmbient *= infantryLightScale; - static Vector3 id (1.0f, 1.0f, 1.0f); - oldDiffuse.Cap_Absolute_To(id); - oldAmbient.Cap_Absolute_To(id); + oldDiffuse *= infantryLightScale; + oldAmbient *= infantryLightScale; + static Vector3 id (1.0f, 1.0f, 1.0f); + oldDiffuse.Cap_Absolute_To(id); + oldAmbient.Cap_Absolute_To(id); m_infantryLight[globalLightIndex]->Set_Ambient(oldAmbient);//CLAMPED m_infantryLight[globalLightIndex]->Set_Diffuse(oldDiffuse);//CLAMPED @@ -1114,14 +1114,14 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) #define USE_LIGHT_ENV 1 - if (!Visibility_Checked) { - // set the visibility bit in all render objects in all layers. - Visibility_Check(&rinfo.Camera); + if (!Visibility_Checked) { + // set the visibility bit in all render objects in all layers. + Visibility_Check(&rinfo.Camera); #ifdef USE_NON_STENCIL_OCCLUSION - flagOccludedObjects(&rinfo.Camera); + flagOccludedObjects(&rinfo.Camera); #endif - } - Visibility_Checked = false; + } + Visibility_Checked = false; RefRenderObjListIterator it(&UpdateList); @@ -1174,7 +1174,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) { // get the render object robj = it.Peek_Obj(); - it.Next(); //advance to next object in case this one gets deleted during renderOneObject(). + it.Next(); //advance to next object in case this one gets deleted during renderOneObject(). if (robj->Class_ID() == RenderObjClass::CLASSID_TILEMAP) continue; //we already rendered terrain @@ -1254,14 +1254,14 @@ void renderStenciledPlayerColor( UnsignedInt color, UnsignedInt stencilRef, Bool width=TheTacticalView->getWidth(); height=TheTacticalView->getHeight(); - v[0].p.Set(xpos+width, ypos+height, 0.0f, 1.0f ); - v[1].p.Set(xpos+width, 0, 0.0f, 1.0f ); - v[2].p.Set(xpos, ypos+height, 0.0f, 1.0f ); - v[3].p.Set(xpos, 0, 0.0f, 1.0f ); - v[0].color = color; - v[1].color = color; - v[2].color = color; - v[3].color = color; + v[0].p.Set(xpos+width, ypos+height, 0.0f, 1.0f ); + v[1].p.Set(xpos+width, 0, 0.0f, 1.0f ); + v[2].p.Set(xpos, ypos+height, 0.0f, 1.0f ); + v[3].p.Set(xpos, 0, 0.0f, 1.0f ); + v[0].color = color; + v[1].color = color; + v[2].color = color; + v[3].color = color; DX8Wrapper::Set_Shader(PlayerColorShader); VertexMaterialClass *vmat=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp index 6cbe32971e4..e28f8148b29 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp @@ -143,7 +143,7 @@ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSi srcWidth=m_numCellsX; //vertical size is larger by 1 pixel so that we have some unused pixels to use in clearing the video texture. //To clear the video texture, I will copy pixels from this unused area. There is no other way to clear a video - //memory texture to a known value because you can't lock it - only copy into it. + //memory texture to a known value because you can't lock it - only copy into it. srcHeight=m_numCellsY; srcHeight += 1; @@ -152,7 +152,7 @@ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSi m_currentFogData = new W3DShroudLevel[srcWidth*srcHeight]; //Clear the fog to black memset(m_currentFogData,0,srcWidth*srcHeight); - memset(m_finalFogData,0,srcWidth*srcHeight); + memset(m_finalFogData,0,srcWidth*srcHeight); #endif #if defined(RTS_DEBUG) @@ -786,7 +786,7 @@ void W3DShroudMaterialPassClass::Install_Materials() const { if (TheTerrainRenderObject->getShroud()) { - W3DShaderManager::setTexture(0,TheTerrainRenderObject->getShroud()->getShroudTexture()); + W3DShaderManager::setTexture(0,TheTerrainRenderObject->getShroud()->getShroudTexture()); W3DShaderManager::setShader(W3DShaderManager::ST_SHROUD_TEXTURE, 0); } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp index 29103210b4c..4fff00f4457 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp @@ -194,7 +194,7 @@ Int W3DStatusCircle::updateCircleVB() const Real theZ = 0.0f; const Real theRadius = 0.02f; const Int theAlpha = 127; - Int diffuse = m_diffuse + (theAlpha<<24); // b g<<8 r<<16 a<<24. + Int diffuse = m_diffuse + (theAlpha<<24); // b g<<8 r<<16 a<<24. Int limit = m_numTriangles; float curAngle = 0; float deltaAngle = 2*PI/limit; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index 9f8b1b1ae10..ce8d76fe33b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -103,7 +103,7 @@ W3DWaypointBuffer::W3DWaypointBuffer() m_texture = WW3DAssetManager::Get_Instance()->Get_Texture( "EXLaser.tga" ); - setDefaultLineStyle(); + setDefaultLineStyle(); } //============================================================================= @@ -151,11 +151,11 @@ void W3DWaypointBuffer::setDefaultLineStyle() void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) { - if ( ! TheInGameUI ) - return; + if ( ! TheInGameUI ) + return; - setDefaultLineStyle(); + setDefaultLineStyle(); @@ -237,94 +237,94 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) - // WAIT! before we go browsing the drawable list for buildings that want to draw their rally points - // lets test for that very special case of having a listeningoutpost selected, and some enemy drawable moused-over - if ( obj->isKindOf( KINDOF_REVEALS_ENEMY_PATHS ) ) - { - - DrawableID enemyID = TheInGameUI->getMousedOverDrawableID(); - Drawable *enemyDraw = TheGameClient->findDrawableByID( enemyID ); - if ( enemyDraw ) - { - Object *enemy = enemyDraw->getObject(); - if ( enemy ) - { - if ( enemy->getRelationship( obj ) == ENEMIES ) - { - - Coord3D delta = *obj->getPosition(); - delta.sub( enemy->getPosition() ); - if ( delta.length() <= obj->getVisionRange() ) // is listening outpost close enough to do this? - { - - - ////////////////////////////////////////////////////////////////////// - AIUpdateInterface *ai = enemy->getAI(); - Int goalSize = ai ? ai->friend_getWaypointGoalPathSize() : 0; - Int gpIdx = ai ? ai->friend_getCurrentGoalPathIndex() : 0; - if( ai ) - { - Bool lineExists = FALSE; - - const Coord3D *pos = enemy->getPosition(); - points[ numPoints++ ].Set( Vector3( pos->x, pos->y, pos->z ) ); - - if ( gpIdx >= 0 && gpIdx < goalSize )// Ooh, the enemy is in waypoint mode - { - - for( int i = gpIdx; i < goalSize; i++ ) - { - const Coord3D *waypoint = ai->friend_getGoalPathPosition( i ); - if( waypoint ) - { - //Render line from previous point to current node. - - if( numPoints < MAX_DISPLAY_NODES + 1 ) - { - points[ numPoints++ ].Set( Vector3( waypoint->x, waypoint->y, waypoint->z ) ); - } - - m_waypointNodeRobj->Set_Position(Vector3(waypoint->x,waypoint->y,waypoint->z)); - WW3D::Render(*m_waypointNodeRobj,localRinfo); - lineExists = TRUE; - } - } - } - else // then enemy may be moving to a goal position - { - const Coord3D *destinationPoint = ai->getGoalPosition(); - if ( destinationPoint->length() > 1.0f ) - { - points[ numPoints++ ].Set( Vector3( destinationPoint->x, destinationPoint->y, destinationPoint->z ) ); - m_waypointNodeRobj->Set_Position(Vector3(destinationPoint->x,destinationPoint->y,destinationPoint->z)); - WW3D::Render(*m_waypointNodeRobj,localRinfo); - lineExists = TRUE; - } - } - - if ( lineExists ) - { - //Now render the lines in one pass! - - m_line->Set_Color( Vector3( 0.95f, 0.5f, 0.0f ) ); - m_line->Set_Width( 3.0f ); - - m_line->Set_Points( numPoints, points ); - m_line->Render( localRinfo ); - } - } - ////////////////////////////////////////////////////////////////////// - - - - - } - } - } - } - - break;// dont even bother with the rest, since this one listening outpost satisfies the single path-line limit - } + // WAIT! before we go browsing the drawable list for buildings that want to draw their rally points + // lets test for that very special case of having a listeningoutpost selected, and some enemy drawable moused-over + if ( obj->isKindOf( KINDOF_REVEALS_ENEMY_PATHS ) ) + { + + DrawableID enemyID = TheInGameUI->getMousedOverDrawableID(); + Drawable *enemyDraw = TheGameClient->findDrawableByID( enemyID ); + if ( enemyDraw ) + { + Object *enemy = enemyDraw->getObject(); + if ( enemy ) + { + if ( enemy->getRelationship( obj ) == ENEMIES ) + { + + Coord3D delta = *obj->getPosition(); + delta.sub( enemy->getPosition() ); + if ( delta.length() <= obj->getVisionRange() ) // is listening outpost close enough to do this? + { + + + ////////////////////////////////////////////////////////////////////// + AIUpdateInterface *ai = enemy->getAI(); + Int goalSize = ai ? ai->friend_getWaypointGoalPathSize() : 0; + Int gpIdx = ai ? ai->friend_getCurrentGoalPathIndex() : 0; + if( ai ) + { + Bool lineExists = FALSE; + + const Coord3D *pos = enemy->getPosition(); + points[ numPoints++ ].Set( Vector3( pos->x, pos->y, pos->z ) ); + + if ( gpIdx >= 0 && gpIdx < goalSize )// Ooh, the enemy is in waypoint mode + { + + for( int i = gpIdx; i < goalSize; i++ ) + { + const Coord3D *waypoint = ai->friend_getGoalPathPosition( i ); + if( waypoint ) + { + //Render line from previous point to current node. + + if( numPoints < MAX_DISPLAY_NODES + 1 ) + { + points[ numPoints++ ].Set( Vector3( waypoint->x, waypoint->y, waypoint->z ) ); + } + + m_waypointNodeRobj->Set_Position(Vector3(waypoint->x,waypoint->y,waypoint->z)); + WW3D::Render(*m_waypointNodeRobj,localRinfo); + lineExists = TRUE; + } + } + } + else // then enemy may be moving to a goal position + { + const Coord3D *destinationPoint = ai->getGoalPosition(); + if ( destinationPoint->length() > 1.0f ) + { + points[ numPoints++ ].Set( Vector3( destinationPoint->x, destinationPoint->y, destinationPoint->z ) ); + m_waypointNodeRobj->Set_Position(Vector3(destinationPoint->x,destinationPoint->y,destinationPoint->z)); + WW3D::Render(*m_waypointNodeRobj,localRinfo); + lineExists = TRUE; + } + } + + if ( lineExists ) + { + //Now render the lines in one pass! + + m_line->Set_Color( Vector3( 0.95f, 0.5f, 0.0f ) ); + m_line->Set_Width( 3.0f ); + + m_line->Set_Points( numPoints, points ); + m_line->Render( localRinfo ); + } + } + ////////////////////////////////////////////////////////////////////// + + + + + } + } + } + } + + break;// dont even bother with the rest, since this one listening outpost satisfies the single path-line limit + } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 485d5f83bd2..6c5eed92da1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -113,9 +113,9 @@ void Win32GameEngine::update() } } - // When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes - // and not regain focus properly when we come back. This seems to wake it up nicely. - AudioAffect aa = (AudioAffect)0x10; + // When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes + // and not regain focus properly when we come back. This seems to wake it up nicely. + AudioAffect aa = (AudioAffect)0x10; TheAudio->setVolume(TheAudio->getVolume( aa ), aa ); } @@ -134,7 +134,7 @@ void Win32GameEngine::update() void Win32GameEngine::serviceWindowsOS() { MSG msg; - Int returnValue; + Int returnValue; // // see if we have any messages to process, a nullptr window handle tells the diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index 59617b6b451..2e3548b7f12 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -178,7 +178,7 @@ set(WW3D2_SRC shader.h #shattersystem.cpp #shattersystem.h - shdlib.h +# shdlib.h #snappts.cpp #snapPts.h sortingrenderer.cpp diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 27422329bbe..07449f736a1 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -86,7 +86,7 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) : CurMotionMode(BASE_POSE) { // Inline struct members can't be initialized in init list for some reason... - ModeAnim.Motion=nullptr; + ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; ModeAnim.LastSyncTime=WW3D::Get_Logic_Time_Milliseconds(); @@ -141,7 +141,7 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) : CurMotionMode(BASE_POSE), HTree(nullptr) { - // Inline struct members can't be initialized in init list for some reason... + // Inline struct members can't be initialized in init list for some reason... ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h index 47cd00273a9..186db8d1ab5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h @@ -154,8 +154,8 @@ class AABoxRenderObjClass : public W3DMPO, public BoxRenderObjClass virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest) override; virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest) override; virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest) override; - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; ///////////////////////////////////////////////////////////////////////////// // AABoxRenderObjClass Interface @@ -205,8 +205,8 @@ class OBBoxRenderObjClass : public W3DMPO, public BoxRenderObjClass virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest) override; virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest) override; virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest) override; - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; ///////////////////////////////////////////////////////////////////////////// // OBBoxRenderObjClass Interface diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp index ba81d577238..e7e721fd7ca 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -599,17 +599,17 @@ void CameraClass::Update_Frustum() const { if (FrustumValid) return; - Vector2 vpmin,vpmax; - float znear,zfar; + Vector2 vpmin,vpmax; + float znear,zfar; float znear_dist,zfar_dist; - Matrix3D cam_mat = Get_Transform(); - Get_View_Plane(vpmin, vpmax); // Normalized view plane at a depth of 1.0 - Get_Clip_Planes(znear_dist, zfar_dist); + Matrix3D cam_mat = Get_Transform(); + Get_View_Plane(vpmin, vpmax); // Normalized view plane at a depth of 1.0 + Get_Clip_Planes(znear_dist, zfar_dist); - // Forward is negative Z in our viewspace coordinate system. - znear = -znear_dist; - zfar = -zfar_dist; + // Forward is negative Z in our viewspace coordinate system. + znear = -znear_dist; + zfar = -zfar_dist; // Update the frustum FrustumValid = true; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h index 6465fcd2a6d..4ef51f7e183 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -137,11 +137,11 @@ class CameraClass : public RenderObjClass virtual void Set_Transform(const Matrix3D &m) override; virtual void Set_Position(const Vector3 &v) override; - ///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// // Render Object Interface - Bounding Volumes ///////////////////////////////////////////////////////////////////////////// virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; /////////////////////////////////////////////////////////////////////////// // Camera parameter control diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h index 4fdc4408672..04641c323cb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h @@ -277,8 +277,8 @@ class DazzleRenderObjClass : public RenderObjClass virtual void Render(RenderInfoClass & rinfo) override; virtual void Special_Render(SpecialRenderInfoClass & rinfo) override; virtual void Set_Transform(const Matrix3D &m) override; - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; virtual void Scale(float scale) override { current_scale*=scale; }; void Set_Dazzle_Color(const Vector3& col) { dazzle_color=col; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp index 2661e719f9c..7c6d19f7974 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp @@ -1009,7 +1009,7 @@ bool DX8Caps::Is_Valid_Display_Format(int width, int height, WW3DFormat format) void DX8Caps::Vendor_Specific_Hacks(const D3DADAPTER_IDENTIFIER8& adapter_id) { if (VendorId==VENDOR_NVIDIA) - { + { if (SupportNPatches) { DXLOG(("NVidia Driver reported N-Patch support, disabling.\r\n")); } @@ -1027,13 +1027,13 @@ void DX8Caps::Vendor_Specific_Hacks(const D3DADAPTER_IDENTIFIER8& adapter_id) SupportTextureFormat[WW3D_FORMAT_DXT5]; - if (DeviceId == DEVICE_NVIDIA_GEFORCE2_MX || + if (DeviceId == DEVICE_NVIDIA_GEFORCE2_MX || DeviceId == DEVICE_NVIDIA_GEFORCE2_MX_400 ) - { + { DXLOG(("Maximum screen resolution limited to 1024 x 768 on NVidia GeForce2 mx/mx400 cards\r\n")); MaxDisplayWidth=1024; MaxDisplayHeight=768; - } + } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.h index e9137e93013..bdae84ed4bf 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.h @@ -60,8 +60,8 @@ enum { DX8_FVF_XYZDUV2 = D3DFVF_XYZ|D3DFVF_TEX2|D3DFVF_DIFFUSE, DX8_FVF_XYZUV1 = D3DFVF_XYZ|D3DFVF_TEX1, DX8_FVF_XYZUV2 = D3DFVF_XYZ|D3DFVF_TEX2, - DX8_FVF_XYZNDUV1TG3 = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX4|D3DFVF_TEXCOORDSIZE2(0)|D3DFVF_TEXCOORDSIZE3(1)|D3DFVF_TEXCOORDSIZE3(2)|D3DFVF_TEXCOORDSIZE3(3)), - DX8_FVF_XYZNUV2DMAP = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE1(0) | D3DFVF_TEXCOORDSIZE4(1) | D3DFVF_TEXCOORDSIZE2(2) ), + DX8_FVF_XYZNDUV1TG3 = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX4|D3DFVF_TEXCOORDSIZE2(0)|D3DFVF_TEXCOORDSIZE3(1)|D3DFVF_TEXCOORDSIZE3(2)|D3DFVF_TEXCOORDSIZE3(3)), + DX8_FVF_XYZNUV2DMAP = (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE1(0) | D3DFVF_TEXCOORDSIZE4(1) | D3DFVF_TEXCOORDSIZE2(2) ), DX8_FVF_XYZNDCUBEMAP = D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE //|D3DFVF_TEX1|D3DFVF_TEXCOORDSIZE3(0) }; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp index ea1bb539196..9798e608512 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -295,20 +295,20 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes() // additional passes MatPassTaskClass * mpr = visible_matpass_head; MatPassTaskClass * last_mpr = nullptr; - bool renderTasksRemaining=false; + bool renderTasksRemaining=false; while (mpr != nullptr) { SNAPSHOT_SAY(("Render_Procedural_Material_Pass")); - MeshClass * mesh = mpr->Peek_Mesh(); + MeshClass * mesh = mpr->Peek_Mesh(); - if (mesh->Get_Base_Vertex_Offset() == VERTEX_BUFFER_OVERFLOW) //check if this mesh is valid - { //skip this mesh so it gets rendered later after vertices are filled in. + if (mesh->Get_Base_Vertex_Offset() == VERTEX_BUFFER_OVERFLOW) //check if this mesh is valid + { //skip this mesh so it gets rendered later after vertices are filled in. last_mpr = mpr; - mpr = mpr->Get_Next_Visible(); - renderTasksRemaining = true; - continue; - } + mpr = mpr->Get_Next_Visible(); + renderTasksRemaining = true; + continue; + } mpr->Peek_Mesh()->Render_Material_Pass(mpr->Peek_Material_Pass(),index_buffer); MatPassTaskClass * next_mpr = mpr->Get_Next_Visible(); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 0d3f6bc7a6d..4f38e4b1b7b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -582,7 +582,7 @@ bool DX8Wrapper::Create_Device() { return false; } - } + } else { return false; @@ -783,7 +783,7 @@ void DX8Wrapper::Enumerate_Devices() bool DX8Wrapper::Set_Any_Render_Device() { - // Then fullscreen + // Try fullscreen first int dev_number = 0; for (; dev_number < _RenderDeviceNameTable.Count(); dev_number++) { if (Set_Render_Device(dev_number,-1,-1,-1,0,false)) { @@ -791,7 +791,7 @@ bool DX8Wrapper::Set_Any_Render_Device() } } - // Try windowed first + // Then windowed for (dev_number = 0; dev_number < _RenderDeviceNameTable.Count(); dev_number++) { if (Set_Render_Device(dev_number,-1,-1,-1,1,false)) { return true; @@ -1347,10 +1347,6 @@ bool DX8Wrapper::Registry_Load_Render_Device( const char * sub_key, bool resize_ TextureBitDepth=16; } - -// _RenderDeviceDescriptionTable. - - if ( Set_Render_Device( name, width,height,depth,windowed, resize_window ) != true) { if (depth==16) depth=32; else depth=16; @@ -2273,7 +2269,7 @@ void DX8Wrapper::Apply_Render_State_Changes() } else { Set_DX8_Light(index,nullptr); - SNAPSHOT_SAY((" clearing light to NULL")); + SNAPSHOT_SAY((" clearing light to null")); } } } @@ -3040,8 +3036,6 @@ void DX8Wrapper::Set_Light(unsigned index,const LightClass &light) void DX8Wrapper::Set_Light_Environment(LightEnvironmentClass* light_env) { // Shader light environment support * -// if (Light_Environment && light_env && (*Light_Environment)==(*light_env)) return; - Light_Environment=light_env; if (light_env) @@ -3838,7 +3832,7 @@ void DX8Wrapper::Apply_Default_State() VertexMaterialClass::Apply_Null(); for (unsigned index=0;index<4;++index) { - SNAPSHOT_SAY(("Clearing light %d to NULL",index)); + SNAPSHOT_SAY(("Clearing light %d to null",index)); Set_DX8_Light(index,nullptr); } @@ -4413,7 +4407,7 @@ const char* DX8Wrapper::Get_DX8_Patch_Edge_Style_Name(unsigned value) { switch (value) { case D3DPATCHEDGE_DISCRETE : return "D3DPATCHEDGE_DISCRETE"; - case D3DPATCHEDGE_CONTINUOUS:return "D3DPATCHEDGE_CONTINUOUS"; + case D3DPATCHEDGE_CONTINUOUS:return "D3DPATCHEDGE_CONTINUOUS"; default : return "UNKNOWN"; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index 937aa6ea6a1..9ab171cc1cb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -200,7 +200,6 @@ struct RenderStateStruct TextureBaseClass * Textures[MAX_TEXTURE_STAGES]; D3DLIGHT8 Lights[4]; bool LightEnable[4]; - //unsigned lightsHash; D3DMATRIX world; D3DMATRIX view; unsigned vertex_buffer_types[MAX_VERTEX_STREAMS]; @@ -878,10 +877,10 @@ WWINLINE void DX8Wrapper::Set_DX8_Clip_Plane(DWORD Index, CONST float* pPlane) WWINLINE void DX8Wrapper::Set_DX8_Texture_Stage_State(unsigned stage, D3DTEXTURESTAGESTATETYPE state, unsigned value) { - if (stage >= MAX_TEXTURE_STAGES) - { DX8CALL(SetTextureStageState( stage, state, value )); - return; - } + if (stage >= MAX_TEXTURE_STAGES) + { DX8CALL(SetTextureStageState( stage, state, value )); + return; + } // Can't monitor state changes because setShader call to GERD may change the states! if (TextureStageStates[stage][(unsigned int)state]==value) return; @@ -903,10 +902,10 @@ WWINLINE void DX8Wrapper::Set_DX8_Texture_Stage_State(unsigned stage, D3DTEXTURE WWINLINE void DX8Wrapper::Set_DX8_Texture(unsigned int stage, IDirect3DBaseTexture8* texture) { - if (stage >= MAX_TEXTURE_STAGES) - { DX8CALL(SetTexture(stage, texture)); - return; - } + if (stage >= MAX_TEXTURE_STAGES) + { DX8CALL(SetTexture(stage, texture)); + return; + } if (Textures[stage]==texture) return; @@ -1359,7 +1358,6 @@ WWINLINE RenderStateStruct::RenderStateStruct() unsigned i; for (i=0;iUpdate_Obj_Space_Bounding_Volumes(); + // Now update the object space bounding volumes of this object's container: + RenderObjClass *container = Get_Container(); + if (container) container->Update_Obj_Space_Bounding_Volumes(); } @@ -3486,12 +3486,12 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes() ObjSphere = sphere; ObjBox = box; - Invalidate_Cached_Bounding_Volumes(); + Invalidate_Cached_Bounding_Volumes(); Set_Hierarchy_Valid(false); - // Now update the object space bounding volumes of this object's container: - RenderObjClass *container = Get_Container(); - if (container) container->Update_Obj_Space_Bounding_Volumes(); + // Now update the object space bounding volumes of this object's container: + RenderObjClass *container = Get_Container(); + if (container) container->Update_Obj_Space_Bounding_Volumes(); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h index 49d85036081..f69ea53690d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h @@ -157,7 +157,7 @@ class HLodClass : public W3DMPO, public Animatable3DObjClass // Render Object Interface - Predictive LOD ///////////////////////////////////////////////////////////////////////////// virtual void Prepare_LOD(CameraClass &camera) override; - virtual void Recalculate_Static_LOD_Factors() override; + virtual void Recalculate_Static_LOD_Factors() override; virtual void Increment_LOD() override; virtual void Decrement_LOD() override; virtual float Get_Cost() const override; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.h index ef97b16e304..ddd0d84693c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.h @@ -72,7 +72,7 @@ class HTreeManagerClass void Free_All_Trees_With_Exclusion_List(const W3DExclusionListClass & exclusion_list); int Get_Tree_ID(const char * name); - char * Get_Tree_Name(const int id); + char * Get_Tree_Name(const int id); private: diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h index 2f9f5f90c90..81faab989be 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h @@ -91,7 +91,7 @@ class LightClass : public RenderObjClass // Bounding volume of a light extends to its attenuation radius ///////////////////////////////////////////////////////////////////////////// virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; ///////////////////////////////////////////////////////////////////////////// // LightClass Interface diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h index 48695c4c2cd..25bf805e206 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h @@ -104,7 +104,7 @@ class LightEnvironmentClass float getPointOrad(int i) const {return InputLights[i].m_outerRadius;} const Vector3 & getPointDiffuse(int i) const { return InputLights[i].m_diffuse; } const Vector3 & getPointAmbient(int i) const { return InputLights[i].m_ambient; } - const Vector3 & getPointCenter(int i) const { return InputLights[i].m_center; } + const Vector3 & getPointCenter(int i) const { return InputLights[i].m_center; } /* ** Lighting LOD. This is a static setting that is used to convert weak diffuse lights diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp index bea618de82a..7d7ef56caaa 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp @@ -237,7 +237,7 @@ void LineGroupClass::Render(RenderInfoClass &rinfo) Shader.Set_Cull_Mode(ShaderClass::CULL_MODE_ENABLE); // If there is a color or alpha array enable gradient in shader - otherwise disable. - float value_255 = 0.9961f; //254 / 255 + float value_255 = 0.9961f; //254 / 255 bool default_white_opaque = ( DefaultLineColor.X > value_255 && DefaultLineColor.Y > value_255 && DefaultLineColor.Z > value_255 && diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.cpp index fa182a696da..4eb8d037732 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.cpp @@ -515,7 +515,7 @@ void StepLinearOffsetTextureMapperClass::Calculate_Texture_Matrix(Matrix4x4 &tex // This works well for clamped textures. if (!ClampFix) { CurrentStep.U -= WWMath::Floor(CurrentStep.U); - CurrentStep.V -= WWMath::Floor(CurrentStep.V); + CurrentStep.V -= WWMath::Floor(CurrentStep.V); } else { CurrentStep.U = WWMath::Clamp(CurrentStep.U, -Scale.X, Scale.X); CurrentStep.V = WWMath::Clamp(CurrentStep.V, -Scale.Y, Scale.Y); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp index 28089f70f8e..8456f121a3e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -443,11 +443,11 @@ void MeshClass::Scale(float scale) Model->Make_Geometry_Unique(); Model->Scale(sc); - Invalidate_Cached_Bounding_Volumes(); + Invalidate_Cached_Bounding_Volumes(); - // Now update the object space bounding volumes of this object's container: - RenderObjClass *container = Get_Container(); - if (container) container->Update_Obj_Space_Bounding_Volumes(); + // Now update the object space bounding volumes of this object's container: + RenderObjClass *container = Get_Container(); + if (container) container->Update_Obj_Space_Bounding_Volumes(); } @@ -475,11 +475,11 @@ void MeshClass::Scale(float scalex, float scaley, float scalez) Model->Make_Geometry_Unique(); Model->Scale(sc); - Invalidate_Cached_Bounding_Volumes(); + Invalidate_Cached_Bounding_Volumes(); - // Now update the object space bounding volumes of this object's container: - RenderObjClass *container = Get_Container(); - if (container) container->Update_Obj_Space_Bounding_Volumes(); + // Now update the object space bounding volumes of this object's container: + RenderObjClass *container = Get_Container(); + if (container) container->Update_Obj_Space_Bounding_Volumes(); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h index d248a1f9a6b..63c344b85f7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h @@ -100,7 +100,7 @@ class MeshClass : public W3DMPO, public RenderObjClass // Render Object Interface - Bounding Volumes ///////////////////////////////////////////////////////////////////////////// virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override; ///////////////////////////////////////////////////////////////////////////// // Render Object Interface - Attributes, Options, Properties, etc @@ -109,8 +109,8 @@ class MeshClass : public W3DMPO, public RenderObjClass virtual void Scale(float scalex, float scaley, float scalez) override; virtual MaterialInfoClass * Get_Material_Info() override; - virtual int Get_Sort_Level() const override; - virtual void Set_Sort_Level(int level) override; + virtual int Get_Sort_Level() const override; + virtual void Set_Sort_Level(int level) override; ///////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index 41115be07bc..12186f09987 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -2441,7 +2441,7 @@ WW3DErrorType MeshModelClass::write_vertices(ChunkSaveClass & csave,MeshSaveCont for (int i=0; i>4); // skip out to current packet - // initial filter index - int fi = (src_idx-1) & 0xF; + // initial filter index + int fi = (src_idx-1) & 0xF; float last_value = srcdata[vi]; @@ -1098,13 +1098,13 @@ void AdaptiveDeltaMotionChannelClass::decompress(uint32 src_idx, float *srcdata, last_value+=delta; if (frame == frame_idx) { - done = true; - break; + done = true; + break; } frame++; } - fi = 0; + fi = 0; if (done) break; // we're at the desired frame @@ -1112,7 +1112,7 @@ void AdaptiveDeltaMotionChannelClass::decompress(uint32 src_idx, float *srcdata, } - outdata[vi] = last_value; + outdata[vi] = last_value; } @@ -1149,49 +1149,49 @@ float AdaptiveDeltaMotionChannelClass::getframe(uint32 frame_idx, uint32 vector_ if (frame_idx < CacheFrame) { // Requested Frame isn't cached, so cache it, and frame_idx+1, and return the decompressed data - // from frame_idx + // from frame_idx - decompress(frame_idx, &CacheData[0]); + decompress(frame_idx, &CacheData[0]); - if (frame_idx != (NumFrames - 1)) { - decompress(frame_idx, &CacheData[0], frame_idx+1, &CacheData[VectorLen]); - } + if (frame_idx != (NumFrames - 1)) { + decompress(frame_idx, &CacheData[0], frame_idx+1, &CacheData[VectorLen]); + } - CacheFrame = frame_idx; + CacheFrame = frame_idx; - return(CacheData[vector_idx]); + return(CacheData[vector_idx]); } - // Copy last known Cached data down + // Copy last known Cached data down - if (frame_idx == (CacheFrame + 2)) { + if (frame_idx == (CacheFrame + 2)) { - // Sliding window - memcpy(&CacheData[0], &CacheData[VectorLen], VectorLen * sizeof(float)); + // Sliding window + memcpy(&CacheData[0], &CacheData[VectorLen], VectorLen * sizeof(float)); - CacheFrame++; + CacheFrame++; - decompress(CacheFrame, &CacheData[0], frame_idx, &CacheData[VectorLen]); + decompress(CacheFrame, &CacheData[0], frame_idx, &CacheData[VectorLen]); - return(CacheData[VectorLen + vector_idx]); - } + return(CacheData[VectorLen + vector_idx]); + } - // Else just use last known frame to decompress forwards + // Else just use last known frame to decompress forwards - assert(VectorLen <= 4); + assert(VectorLen <= 4); - float temp[4]; + float temp[4]; - memcpy(&temp[0], &CacheData[VectorLen], VectorLen * sizeof(float)); + memcpy(&temp[0], &CacheData[VectorLen], VectorLen * sizeof(float)); - decompress(CacheFrame, &temp[0], frame_idx, &CacheData[0]); - CacheFrame = frame_idx; + decompress(CacheFrame, &temp[0], frame_idx, &CacheData[0]); + CacheFrame = frame_idx; - if (frame_idx != (NumFrames - 1)) { - decompress(CacheFrame, &CacheData[0], frame_idx+1, &CacheData[VectorLen]); - } + if (frame_idx != (NumFrames - 1)) { + decompress(CacheFrame, &CacheData[0], frame_idx+1, &CacheData[VectorLen]); + } - return(CacheData[vector_idx]); + return(CacheData[vector_idx]); } @@ -1217,7 +1217,7 @@ void AdaptiveDeltaMotionChannelClass::Get_Vector(float32 frame,float * setvec) float value1 = getframe(frame1); float value2 = getframe(frame1 + 1); - *setvec = WWMath::Lerp(value1,value2,ratio); + *setvec = WWMath::Lerp(value1,value2,ratio); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.h index 067708080f5..542382285f7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.h @@ -280,8 +280,8 @@ class AdaptiveDeltaMotionChannelClass : public W3DMPO void Free(); float getframe(uint32 frame_idx, uint32 vector_idx=0); - void decompress(uint32 frame_idx, float *outdata); - void decompress(uint32 src_idx, float *srcdata, uint32 frame_idx, float *outdata); + void decompress(uint32 frame_idx, float *outdata); + void decompress(uint32 src_idx, float *srcdata, uint32 frame_idx, float *outdata); friend class HCompressedAnimClass; }; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/nullrobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/nullrobj.cpp index 47e9688f8ac..7d10d4e987b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/nullrobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/nullrobj.cpp @@ -76,7 +76,7 @@ void Null3DObjClass::Render(RenderInfoClass & rinfo) void Null3DObjClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const { - sphere.Center.Set(0,0,0); + sphere.Center.Set(0,0,0); sphere.Radius = 0.1f; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index 72688594405..f202054e58b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -1876,7 +1876,7 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro { unsigned int i; // Used in loops - float oo_intmax = 1.0f / (float)INT_MAX; + float oo_intmax = 1.0f / (float)INT_MAX; unsigned int ui_previous_key_time = 0; unsigned int ui_current_key_time = 0; @@ -2069,7 +2069,7 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) { unsigned int i; // Used in loops - float oo_intmax = 1.0f / (float)INT_MAX; + float oo_intmax = 1.0f / (float)INT_MAX; unsigned int ui_previous_key_time = 0; unsigned int ui_current_key_time = 0; @@ -2219,7 +2219,7 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl { unsigned int i; // Used in loops - float oo_intmax = 1.0f / (float)INT_MAX; + float oo_intmax = 1.0f / (float)INT_MAX; unsigned int ui_previous_key_time = 0; unsigned int ui_current_key_time = 0; @@ -2392,7 +2392,7 @@ NewParticleStruct * ParticleBufferClass::Add_Uninitialized_New_Particle() // Push new particle on new particle queue. If it overflows, just adjust // queue to remove oldest member (which is the one which was overwritten). NewParticleStruct *ptr = &(NewParticleQueue[NewParticleQueueEnd]); - if (++NewParticleQueueEnd == MaxNum) NewParticleQueueEnd = 0; + if (++NewParticleQueueEnd == MaxNum) NewParticleQueueEnd = 0; if (++NewParticleQueueCount == (signed)(MaxNum + 1)) { // Overflow - advance queue start: if (++NewParticleQueueStart == MaxNum) NewParticleQueueStart = 0; @@ -2737,7 +2737,7 @@ void ParticleBufferClass::Update_Bounding_Box() sub1_end = MaxNum; sub2_start = 0; } - for (i = Start; i < sub1_end; i++) { + for (i = Start; i < sub1_end; i++) { max_coords.X = max_coords.X >= position[i].X ? max_coords.X : position[i].X; max_coords.Y = max_coords.Y >= position[i].Y ? max_coords.Y : position[i].Y; max_coords.Z = max_coords.Z >= position[i].Z ? max_coords.Z : position[i].Z; @@ -2745,7 +2745,7 @@ void ParticleBufferClass::Update_Bounding_Box() min_coords.Y = min_coords.Y <= position[i].Y ? min_coords.Y : position[i].Y; min_coords.Z = min_coords.Z <= position[i].Z ? min_coords.Z : position[i].Z; } - for (i = sub2_start; i < End; i++) { + for (i = sub2_start; i < End; i++) { max_coords.X = max_coords.X >= position[i].X ? max_coords.X : position[i].X; max_coords.Y = max_coords.Y >= position[i].Y ? max_coords.Y : position[i].Y; max_coords.Z = max_coords.Z >= position[i].Z ? max_coords.Z : position[i].Z; @@ -2827,25 +2827,25 @@ void ParticleBufferClass::Get_New_Particles() // Advance the 'end of new particles' index. NewEnd++; - if (NewEnd == MaxNum) NewEnd = 0; + if (NewEnd == MaxNum) NewEnd = 0; - // Update the new particles count. - NewNum++; + // Update the new particles count. + NewNum++; // If we have just overflowed the total buffer, advance Start. - if ((NewNum + NonNewNum) == (signed)(MaxNum + 1)) { - Start++; - if (Start == MaxNum) Start = 0; - NonNewNum--; - - // If this underflows the 'non-new' buffer, advance End. - if (NonNewNum == -1) { - End++; - if (End == MaxNum) End = 0; - NonNewNum = 0; - NewNum--; - } - } + if ((NewNum + NonNewNum) == (signed)(MaxNum + 1)) { + Start++; + if (Start == MaxNum) Start = 0; + NonNewNum--; + + // If this underflows the 'non-new' buffer, advance End. + if (NonNewNum == -1) { + End++; + if (End == MaxNum) End = 0; + NonNewNum = 0; + NewNum--; + } + } } } @@ -2868,28 +2868,28 @@ void ParticleBufferClass::Kill_Old_Particles() sub2_start = 0; } - unsigned int current_time = WW3D::Get_Sync_Time(); + unsigned int current_time = WW3D::Get_Sync_Time(); // Stop when the current particle is young enough to be alive. bool broke = false; - for (i = Start; i < sub1_end; i++) { - if ((current_time - TimeStamp[i]) < MaxAge) { - broke = true; - break; - } - NonNewNum--; - } - if (!broke) { + for (i = Start; i < sub1_end; i++) { + if ((current_time - TimeStamp[i]) < MaxAge) { + broke = true; + break; + } + NonNewNum--; + } + if (!broke) { for (i = sub2_start; i < End; i++) { if ((current_time - TimeStamp[i]) < MaxAge) break; - NonNewNum--; + NonNewNum--; } - } + } Start = i; - // NOTE: we do not scan the new particles, because they have been already - // preculled to be under MaxAge. + // NOTE: we do not scan the new particles, because they have been already + // preculled to be under MaxAge. } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h index aa5f1b7900e..129cd58a89d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h @@ -163,7 +163,7 @@ class ParticleBufferClass : public RenderObjClass void Set_Emitter(ParticleEmitterClass *emitter); // from RenderObj... - virtual bool Is_Complete() override { return IsEmitterDead && !NonNewNum && !NewNum; } + virtual bool Is_Complete() override { return IsEmitterDead && !NonNewNum && !NewNum; } // This adds an uninitialized NewParticleStuct to the new particle // buffer and returns its address so the particle emitter can diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 8e72c0b017e..5e7c9c43251 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -549,10 +549,10 @@ void ParticleEmitterClass::Update_Cached_Bounding_Volumes() const // slerping the orientation and lerping the origin. void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, const Vector3 & curr_orig) { - Quaternion quat; - Vector3 orig; + Quaternion quat; + Vector3 orig; - // The emit remainder from the previous interval (the time remaining in + // The emit remainder from the previous interval (the time remaining in // the previous interval when the last particle was emitted) is added to // the size of the current frame to yield the time currently available // for emitting particles. @@ -575,15 +575,15 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co EmitRemain += frametime; // The interpolation factor (0: start of interval: 1: end of interval). - // Possibly negative at this point, but after the delta is added to it, it - // will be positive. + // Possibly negative at this point, but after the delta is added to it, it + // will be positive. float fl_frametime = (float)frametime; - float alpha = 1 - ((float)EmitRemain / fl_frametime); - float d_alpha = (float)EmitRate / fl_frametime; + float alpha = 1 - ((float)EmitRemain / fl_frametime); + float d_alpha = (float)EmitRate / fl_frametime; - // Setup the slerp between the two quaternions. - SlerpInfoStruct slerp_info; - Slerp_Setup(PrevQ, curr_quat, &slerp_info); + // Setup the slerp between the two quaternions. + SlerpInfoStruct slerp_info; + Slerp_Setup(PrevQ, curr_quat, &slerp_info); // Find the velocity of the emitter (for velocity inheritance). // InheritedWorldSpaceEmitterVel is a global variable which is only used @@ -595,16 +595,16 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co InheritedWorldSpaceEmitterVel.Set(0.0, 0.0, 0.0); } - for (; EmitRemain > EmitRate;) { + for (; EmitRemain > EmitRate;) { // Calculate the new remainder. EmitRemain -= EmitRate; - // Interpolate the start and end transforms to find the transform at - // the moment of particle creation. - alpha += d_alpha; - quat = Cached_Slerp(PrevQ, curr_quat, alpha, &slerp_info); - Vector3::Lerp(PrevOrig, curr_orig, alpha, &orig); + // Interpolate the start and end transforms to find the transform at + // the moment of particle creation. + alpha += d_alpha; + quat = Cached_Slerp(PrevQ, curr_quat, alpha, &slerp_info); + Vector3::Lerp(PrevOrig, curr_orig, alpha, &orig); // Initialize BurstSize new particles with the given age and emitter // transform (expressed as a quaternion and origin vector), and add it @@ -643,10 +643,10 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co void ParticleEmitterClass::Initialize_Particle(NewParticleStruct * newpart, unsigned int timestamp, const Quaternion & quat, const Vector3 & orig) { - // Set time stamp. + // Set time stamp. newpart->TimeStamp = timestamp; - // Set starting (random) local position. + // Set starting (random) local position. Vector3 rand_pos; if (PosRand) { PosRand->Get_Vector(rand_pos); @@ -655,7 +655,7 @@ void ParticleEmitterClass::Initialize_Particle(NewParticleStruct * newpart, } // Transform position to worldspace, using the transform at moment of - // particle creation. + // particle creation. newpart->Position = quat.Rotate_Vector(rand_pos) + orig; // Set (random) local velocity. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h index 09f97eba971..3bde54ac8a8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -149,8 +149,8 @@ class ParticleEmitterClass : public RenderObjClass // - hopefully can be rewritten more cleanly in future)... virtual void On_Frame_Update() override; - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override { sphere.Center.Set(0,0,0); sphere.Radius = 0; } - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override { box.Center.Set(0,0,0); box.Extent.Set(0,0,0); } + virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override { sphere.Center.Set(0,0,0); sphere.Radius = 0; } + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const override { box.Center.Set(0,0,0); box.Extent.Set(0,0,0); } virtual void Set_Hidden(int onoff) override { RenderObjClass::Set_Hidden (onoff); Update_On_Visibility (); } virtual void Set_Visible(int onoff) override { RenderObjClass::Set_Visible (onoff); Update_On_Visibility (); } virtual void Set_Animation_Hidden(int onoff) override { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibility (); } @@ -208,7 +208,7 @@ class ParticleEmitterClass : public RenderObjClass void Remove_Buffer_From_Scene () { Buffer->Remove (); FirstTime = true; BufferSceneNeeded = true; } // from RenderObj... - virtual bool Is_Complete() override { return IsComplete; } + virtual bool Is_Complete() override { return IsComplete; } // Auto deletion behavior controls bool Is_Remove_On_Complete_Enabled() { return RemoveOnComplete; } @@ -289,15 +289,15 @@ class ParticleEmitterClass : public RenderObjClass private: // Collision sphere is a point - emitter emits also when not visible, - // so this is only important to avoid affecting the collision spheres - // of hierarchy objects into which the emitter is inserted. + // so this is only important to avoid affecting the collision spheres + // of hierarchy objects into which the emitter is inserted. virtual void Update_Cached_Bounding_Volumes() const override; - // Create new particles and pass them to the particle buffer. Receives - // the end-of-interval quaternion and origin and interpolates between - // them and PrevQ/PrevOrig to get the transform to apply to each - // particle's position and velocity as it is created. New particles are - // placed into a circular queue for processing by the particle buffer. + // Create new particles and pass them to the particle buffer. Receives + // the end-of-interval quaternion and origin and interpolates between + // them and PrevQ/PrevOrig to get the transform to apply to each + // particle's position and velocity as it is created. New particles are + // placed into a circular queue for processing by the particle buffer. void Create_New_Particles(const Quaternion & curr_quat, const Vector3 & curr_orig); // Initialize one new particle at the given NewParticleStruct diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index 7b40040c81a..df31a5e2025 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -1871,6 +1871,6 @@ ParticleEmitterLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) } } - // Return a pointer to the prototype + // Return a pointer to the prototype return pprototype; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 0266f747df9..4d37605fe66 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -77,7 +77,7 @@ Render2DClass::Render2DClass( TextureClass* tex ) : Colors(sizeof(PreAllocatedColors)/sizeof(unsigned long),PreAllocatedColors) { Set_Texture( tex ); - Shader = Get_Default_Shader(); + Shader = Get_Default_Shader(); return ; } @@ -103,7 +103,7 @@ Render2DClass::Get_Default_Shader() { ShaderClass shader; - shader.Set_Depth_Mask( ShaderClass::DEPTH_WRITE_DISABLE ); + shader.Set_Depth_Mask( ShaderClass::DEPTH_WRITE_DISABLE ); shader.Set_Depth_Compare( ShaderClass::PASS_ALWAYS ); shader.Set_Dst_Blend_Func( ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA ); shader.Set_Src_Blend_Func( ShaderClass::SRCBLEND_SRC_ALPHA ); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp index a45afeac30f..712161dfd95 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -474,7 +474,7 @@ void SimpleSceneClass::Visibility_Check(CameraClass * camera) } } - Visibility_Checked = true; + Visibility_Checked = true; } @@ -536,14 +536,14 @@ void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo) { // SceneClass::Render(rinfo); - // If visibility has not been checked for this scene since the last - // Render() call, check it (set/clear the visibility bit in all render - // objects in the scene). - if (!Visibility_Checked) { - // set the visibility bit in all render objects in all layers. + // If visibility has not been checked for this scene since the last + // Render() call, check it (set/clear the visibility bit in all render + // objects in the scene). + if (!Visibility_Checked) { + // set the visibility bit in all render objects in all layers. Visibility_Check(&rinfo.Camera); - } - Visibility_Checked = false; + } + Visibility_Checked = false; RefRenderObjListIterator it(&UpdateList); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h index 47a54cdc993..305cffde4c2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h @@ -245,8 +245,8 @@ class SimpleSceneClass : public SceneClass protected: - // Has a visibility check been performed since scene was last rendered? - bool Visibility_Checked; + // Has a visibility check been performed since scene was last rendered? + bool Visibility_Checked; RefRenderObjListClass RenderList; RefRenderObjListClass UpdateList; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp index d6534b945ae..4f19b79b495 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp @@ -380,17 +380,17 @@ const Blend srcBlendLUT[ShaderClass::SRCBLEND_MAX] = Blend(D3DBLEND_ZERO, false), Blend(D3DBLEND_ONE, false), Blend(D3DBLEND_SRCALPHA, true), - Blend(D3DBLEND_DESTCOLOR, true) + Blend(D3DBLEND_DESTCOLOR, true) }; const Blend dstBlendLUT[ShaderClass::DSTBLEND_MAX] = { Blend(D3DBLEND_ZERO, false), Blend(D3DBLEND_ONE, false), - Blend(D3DBLEND_SRCCOLOR, false), - Blend(D3DBLEND_INVSRCCOLOR, false), - Blend(D3DBLEND_SRCALPHA, true), - Blend(D3DBLEND_INVSRCALPHA, true) + Blend(D3DBLEND_SRCCOLOR, false), + Blend(D3DBLEND_INVSRCCOLOR, false), + Blend(D3DBLEND_SRCALPHA, true), + Blend(D3DBLEND_INVSRCALPHA, true) }; @@ -1187,22 +1187,22 @@ const StringClass& ShaderClass::Get_Description(StringClass& str) const switch (Get_Dst_Blend_Func()) { case DSTBLEND_ZERO: str+="DSTBLEND_ZERO | "; break; - case DSTBLEND_ONE: str+="DSTBLEND_ONE | "; break; - case DSTBLEND_SRC_COLOR: str+="DSTBLEND_SRC_COLOR | "; break; - case DSTBLEND_ONE_MINUS_SRC_COLOR: str+="DSTBLEND_ONE_MINUS_SRC_COLOR | "; break; - case DSTBLEND_SRC_ALPHA: str+="DSTBLEND_SRC_ALPHA | "; break; - case DSTBLEND_ONE_MINUS_SRC_ALPHA: str+="DSTBLEND_ONE_MINUS_SRC_ALPHA | "; break; + case DSTBLEND_ONE: str+="DSTBLEND_ONE | "; break; + case DSTBLEND_SRC_COLOR: str+="DSTBLEND_SRC_COLOR | "; break; + case DSTBLEND_ONE_MINUS_SRC_COLOR: str+="DSTBLEND_ONE_MINUS_SRC_COLOR | "; break; + case DSTBLEND_SRC_ALPHA: str+="DSTBLEND_SRC_ALPHA | "; break; + case DSTBLEND_ONE_MINUS_SRC_ALPHA: str+="DSTBLEND_ONE_MINUS_SRC_ALPHA | "; break; } switch (Get_Fog_Func()) { case FOG_DISABLE: str+="FOG_DISABLE | "; break; - case FOG_ENABLE: str+="FOG_ENABLE | "; break; - case FOG_SCALE_FRAGMENT: str+="FOG_SCALE_FRAGMENT | "; break; - case FOG_WHITE: str+="FOG_WHITE | "; break; + case FOG_ENABLE: str+="FOG_ENABLE | "; break; + case FOG_SCALE_FRAGMENT: str+="FOG_SCALE_FRAGMENT | "; break; + case FOG_WHITE: str+="FOG_WHITE | "; break; } switch (Get_Primary_Gradient()) { - case GRADIENT_DISABLE: str+="GRADIENT_DISABLE | "; break; + case GRADIENT_DISABLE: str+="GRADIENT_DISABLE | "; break; case GRADIENT_MODULATE: str+="GRADIENT_MODULATE | "; break; case GRADIENT_ADD: str+="GRADIENT_ADD | "; break; case GRADIENT_BUMPENVMAP: str+="GRADIENT_BUMPENVMAP | "; break; @@ -1216,10 +1216,10 @@ const StringClass& ShaderClass::Get_Description(StringClass& str) const } switch (Get_Src_Blend_Func()) { - case SRCBLEND_ZERO: str+="SRCBLEND_ZERO | "; break; - case SRCBLEND_ONE: str+="SRCBLEND_ONE | "; break; - case SRCBLEND_SRC_ALPHA: str+="SRCBLEND_SRC_ALPHA | "; break; - case SRCBLEND_ONE_MINUS_SRC_ALPHA: str+="SRCBLEND_ONE_MINUS_SRC_ALPHA | "; break; + case SRCBLEND_ZERO: str+="SRCBLEND_ZERO | "; break; + case SRCBLEND_ONE: str+="SRCBLEND_ONE | "; break; + case SRCBLEND_SRC_ALPHA: str+="SRCBLEND_SRC_ALPHA | "; break; + case SRCBLEND_ONE_MINUS_SRC_ALPHA: str+="SRCBLEND_ONE_MINUS_SRC_ALPHA | "; break; } switch (Get_Texturing()) { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h index 1179635c273..c926d96093b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.h @@ -111,8 +111,8 @@ class ShaderClass COLOR_WRITE_ENABLE, // enable color buffer writes (default) }; - enum DetailAlphaFuncType - { + enum DetailAlphaFuncType + { DETAILALPHA_DISABLE=0, // local (default) DETAILALPHA_DETAIL, // other DETAILALPHA_SCALE, // local * other @@ -120,8 +120,8 @@ class ShaderClass }; enum DetailColorFuncType - { - DETAILCOLOR_DISABLE=0, // 0000 local (default) + { + DETAILCOLOR_DISABLE=0, // 0000 local (default) DETAILCOLOR_DETAIL, // 0001 other DETAILCOLOR_SCALE, // 0010 local * other DETAILCOLOR_INVSCALE, // 0011 ~(~local * ~other) = local + (1-local)*other @@ -148,35 +148,35 @@ class ShaderClass NPATCH_ENABLE, }; - enum DstBlendFuncType - { - DSTBLEND_ZERO=0, // destination pixel doesn't affect blending (default) - DSTBLEND_ONE, // destination pixel added unmodified - DSTBLEND_SRC_COLOR, // destination pixel multiplied by fragment RGB components - DSTBLEND_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components - DSTBLEND_SRC_ALPHA, // destination pixel multiplied by fragment alpha component - DSTBLEND_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha + enum DstBlendFuncType + { + DSTBLEND_ZERO=0, // destination pixel doesn't affect blending (default) + DSTBLEND_ONE, // destination pixel added unmodified + DSTBLEND_SRC_COLOR, // destination pixel multiplied by fragment RGB components + DSTBLEND_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components + DSTBLEND_SRC_ALPHA, // destination pixel multiplied by fragment alpha component + DSTBLEND_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha DSTBLEND_MAX - }; + }; enum FogFuncType - { - FOG_DISABLE=0, // don't perform fogging (default) - FOG_ENABLE, // apply fog, f*fogColor + (1-f)*fragment - FOG_SCALE_FRAGMENT, // fog scalar value multiplies fragment, (1-f)*fragment - FOG_WHITE, // fog scalar value replaces fragment, f*fogColor - }; - - enum PriGradientType - { - GRADIENT_DISABLE=0, // 000 disable primary gradient (same as OpenGL 'decal' texture blend) + { + FOG_DISABLE=0, // don't perform fogging (default) + FOG_ENABLE, // apply fog, f*fogColor + (1-f)*fragment + FOG_SCALE_FRAGMENT, // fog scalar value multiplies fragment, (1-f)*fragment + FOG_WHITE, // fog scalar value replaces fragment, f*fogColor + }; + + enum PriGradientType + { + GRADIENT_DISABLE=0, // 000 disable primary gradient (same as OpenGL 'decal' texture blend) GRADIENT_MODULATE, // 001 modulate fragment ARGB by gradient ARGB (default) GRADIENT_ADD, // 010 add gradient RGB to fragment RGB, copy gradient A to fragment A GRADIENT_BUMPENVMAP, // 011 environment-mapped bump mapping GRADIENT_BUMPENVMAPLUMINANCE, // 100 environment-mapped bump mapping with luminance control GRADIENT_MODULATE2X, // 101 modulate fragment ARGB by gradient ARGB and multiply RGB by 2 - }; + }; enum SecGradientType { @@ -185,14 +185,14 @@ class ShaderClass }; enum SrcBlendFuncType - { - SRCBLEND_ZERO=0, // fragment not added to color buffer - SRCBLEND_ONE, // fragment added unmodified to color buffer (default) - SRCBLEND_SRC_ALPHA, // fragment RGB components multiplied by fragment A - SRCBLEND_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A + { + SRCBLEND_ZERO=0, // fragment not added to color buffer + SRCBLEND_ONE, // fragment added unmodified to color buffer (default) + SRCBLEND_SRC_ALPHA, // fragment RGB components multiplied by fragment A + SRCBLEND_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A SRCBLEND_MAX - }; + }; enum TexturingType { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp index bc855b2d529..53a468ca81d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -231,7 +231,7 @@ void SortingRendererClass::Insert_Triangles( DX8Wrapper::Get_Render_State(state->sorting_state); - WWASSERT( + WWASSERT( ((state->sorting_state.index_buffer_type==BUFFER_TYPE_SORTING || state->sorting_state.index_buffer_type==BUFFER_TYPE_DYNAMIC_SORTING) && (state->sorting_state.vertex_buffer_types[0]==BUFFER_TYPE_SORTING || state->sorting_state.vertex_buffer_types[0]==BUFFER_TYPE_DYNAMIC_SORTING))); @@ -370,7 +370,7 @@ static void Apply_Render_State(RenderStateStruct& render_state) if (!render_state.material->Get_Lighting()) return; //no point changing lights if they are ignored. - //prevLight = render_state.lightsHash; + //prevLight = render_state.lightsHash; if (render_state.LightEnable[0]) { DX8Wrapper::Set_DX8_Light(0,&render_state.Lights[0]); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h index e689916aac5..8ae5234e34b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h @@ -513,7 +513,7 @@ enum { W3D_CHUNK_SHDSUBMESH_SHADER_CLASSID, W3D_CHUNK_SHDSUBMESH_SHADER_DEF, - W3D_CHUNK_SHDSUBMESH_VERTICES, // array of vertices (array of W3dVectorStruct's) + W3D_CHUNK_SHDSUBMESH_VERTICES, // array of vertices (array of W3dVectorStruct's) W3D_CHUNK_SHDSUBMESH_VERTEX_NORMALS, // array of normals (array of W3dVectorStruct's) W3D_CHUNK_SHDSUBMESH_TRIANGLES, // array of 16bit int triplets (vertex indices for each triangle) W3D_CHUNK_SHDSUBMESH_VERTEX_SHADE_INDICES, // shade indexes for each vertex (array of uint32's) @@ -783,13 +783,13 @@ enum W3DSHADER_ALPHATEST_ENABLE, // enable alpha testing W3DSHADER_ALPHATEST_MAX, // end of enumeration - W3DSHADER_DESTBLENDFUNC_ZERO = 0, // destination pixel doesn't affect blending (default) - W3DSHADER_DESTBLENDFUNC_ONE, // destination pixel added unmodified - W3DSHADER_DESTBLENDFUNC_SRC_COLOR, // destination pixel multiplied by fragment RGB components - W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components - W3DSHADER_DESTBLENDFUNC_SRC_ALPHA, // destination pixel multiplied by fragment alpha component - W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha - W3DSHADER_DESTBLENDFUNC_SRC_COLOR_PREFOG, // destination pixel multiplied by fragment RGB components prior to fogging + W3DSHADER_DESTBLENDFUNC_ZERO = 0, // destination pixel doesn't affect blending (default) + W3DSHADER_DESTBLENDFUNC_ONE, // destination pixel added unmodified + W3DSHADER_DESTBLENDFUNC_SRC_COLOR, // destination pixel multiplied by fragment RGB components + W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_COLOR, // destination pixel multiplied by one minus (i.e. inverse) fragment RGB components + W3DSHADER_DESTBLENDFUNC_SRC_ALPHA, // destination pixel multiplied by fragment alpha component + W3DSHADER_DESTBLENDFUNC_ONE_MINUS_SRC_ALPHA, // destination pixel multiplied by fragment inverse alpha + W3DSHADER_DESTBLENDFUNC_SRC_COLOR_PREFOG, // destination pixel multiplied by fragment RGB components prior to fogging W3DSHADER_DESTBLENDFUNC_MAX, // end of enumeration W3DSHADER_PRIGRADIENT_DISABLE = 0, // disable primary gradient (same as OpenGL 'decal' texture blend) @@ -804,10 +804,10 @@ enum W3DSHADER_SECGRADIENT_ENABLE, // add secondary gradient RGB to fragment RGB W3DSHADER_SECGRADIENT_MAX, // end of enumeration - W3DSHADER_SRCBLENDFUNC_ZERO = 0, // fragment not added to color buffer - W3DSHADER_SRCBLENDFUNC_ONE, // fragment added unmodified to color buffer (default) - W3DSHADER_SRCBLENDFUNC_SRC_ALPHA, // fragment RGB components multiplied by fragment A - W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A + W3DSHADER_SRCBLENDFUNC_ZERO = 0, // fragment not added to color buffer + W3DSHADER_SRCBLENDFUNC_ONE, // fragment added unmodified to color buffer (default) + W3DSHADER_SRCBLENDFUNC_SRC_ALPHA, // fragment RGB components multiplied by fragment A + W3DSHADER_SRCBLENDFUNC_ONE_MINUS_SRC_ALPHA, // fragment RGB components multiplied by fragment inverse (one minus) A W3DSHADER_SRCBLENDFUNC_MAX, // end of enumeration W3DSHADER_TEXTURING_DISABLE = 0, // no texturing (treat fragment initial color as 1,1,1,1) (default) @@ -1465,8 +1465,8 @@ enum // enum { - ANIM_FLAVOR_TIMECODED = 0, - ANIM_FLAVOR_ADAPTIVE_DELTA, + ANIM_FLAVOR_TIMECODED = 0, + ANIM_FLAVOR_ADAPTIVE_DELTA, ANIM_FLAVOR_VALID }; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 2aa6e707339..f73bb737f8a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -279,7 +279,7 @@ WW3DErrorType WW3D::Init(void *hwnd, char *defaultpal, bool lite) WWDEBUG_SAY(("Allocate Debug Resources")); Allocate_Debug_Resources(); - MMRESULT r=timeBeginPeriod(1); + MMRESULT r=timeBeginPeriod(1); WWASSERT(r==TIMERR_NOERROR); /* @@ -800,16 +800,16 @@ WW3DErrorType WW3D::Begin_Render(bool clear,bool clearz,const Vector3 & color, f if (DX8Wrapper::_Get_D3D_Device8() && (hr=DX8Wrapper::_Get_D3D_Device8()->TestCooperativeLevel()) != D3D_OK) { - // If the device was lost, do not render until we get it back - if( D3DERR_DEVICELOST == hr ) - return WW3D_ERROR_GENERIC; //other app has the device - - // Check if the device needs to be reset - if( D3DERR_DEVICENOTRESET == hr ) - { - WWDEBUG_SAY(("WW3D::Begin_Render is resetting the device.")); - DX8Wrapper::Reset_Device(); - } + // If the device was lost, do not render until we get it back + if( D3DERR_DEVICELOST == hr ) + return WW3D_ERROR_GENERIC; //other app has the device + + // Check if the device needs to be reset + if( D3DERR_DEVICENOTRESET == hr ) + { + WWDEBUG_SAY(("WW3D::Begin_Render is resetting the device.")); + DX8Wrapper::Reset_Device(); + } return WW3D_ERROR_GENERIC; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index b70c737e066..b5624022bc7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -219,7 +219,7 @@ class WW3D ** Get_Ext_Swap_Interval - what is our current setting for the swap interval? */ static void Set_Ext_Swap_Interval(long swap); - static long Get_Ext_Swap_Interval(); + static long Get_Ext_Swap_Interval(); /* ** Texture Reduction - all currently loaded textures can be de-resed on the fly @@ -324,10 +324,10 @@ class WW3D static void Activate_Snapshot(bool b) { SnapshotActivated=b; } // These clock all the time under user control, and are used to update - // Stats.UserStat* when performance sampling is enabled. - static long UserStat0; - static long UserStat1; - static long UserStat2; + // Stats.UserStat* when performance sampling is enabled. + static long UserStat0; + static long UserStat1; + static long UserStat2; // Gamma control static void Set_Gamma(float gamma,float bright,float contrast,bool calibrate=true); @@ -438,7 +438,7 @@ struct RenderStatistics { // General statistics double ElapsedSeconds; - int FramesRendered; + int FramesRendered; // Geometry engine statistics double TrianglesReceived; @@ -473,8 +473,8 @@ struct RenderStatistics long MemUsed; long MaxMemory; - // User stats (can be used to see how often a function is called, etc.) - long UserStat0; - long UserStat1; - long UserStat2; + // User stats (can be used to see how often a function is called, etc.) + long UserStat0; + long UserStat1; + long UserStat2; }; diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index d285cb8ad46..a7cfc665bb4 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -694,14 +694,14 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin // register the window class - WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, WndProc, 0, 0, hInstance, + WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, WndProc, 0, 0, hInstance, LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ApplicationIcon)), nullptr/*LoadCursor(nullptr, IDC_ARROW)*/, (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT("Game Window") }; - RegisterClass( &wndClass ); + RegisterClass( &wndClass ); - // Create our main window + // Create our main window windowStyle = WS_POPUP|WS_VISIBLE; if (runWindowed) windowStyle |= WS_MINIMIZEBOX | WS_SYSMENU | WS_DLGFRAME | WS_CAPTION; @@ -722,7 +722,7 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin gInitializing = true; - HWND hWnd = CreateWindow( TEXT("Game Window"), + HWND hWnd = CreateWindow( TEXT("Game Window"), TEXT("Command and Conquer Generals"), windowStyle, (GetSystemMetrics( SM_CXSCREEN ) / 2) - (startWidth / 2), // original position X @@ -794,7 +794,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, Int exitcode = 1; #ifdef RTS_PROFILE - Profile::StartRange("init"); + Profile::StartRange("init"); #endif try { diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditColor.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditColor.h index 71fccd5568d..4adf91de40b 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditColor.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditColor.h @@ -82,9 +82,9 @@ struct RGBColorReal //----------------------------------------------------------------------------- struct HSVColorReal { - Real hue; - Real saturation; - Real value; + Real hue; + Real saturation; + Real value; Real alpha; }; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h index 19f2f4803eb..7b278b8f2d4 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h @@ -64,68 +64,68 @@ class GUIEditDisplay : public Display public: GUIEditDisplay( void ); - virtual ~GUIEditDisplay( void ); + virtual ~GUIEditDisplay( void ) override; - virtual void draw( void ) { }; + virtual void draw( void ) override { }; /// draw a line on the display in pixel coordinates with the specified color virtual void drawLine( Int startX, Int startY, Int endX, Int endY, - Real lineWidth, UnsignedInt lineColor ); + Real lineWidth, UnsignedInt lineColor ) override; virtual void drawLine( Int startX, Int startY, Int endX, Int endY, - Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) { } + Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) override { } /// draw a rect border on the display in pixel coordinates with the specified color virtual void drawOpenRect( Int startX, Int startY, Int width, Int height, - Real lineWidth, UnsignedInt lineColor ); + Real lineWidth, UnsignedInt lineColor ) override; /// draw a filled rect on the display in pixel coords with the specified color virtual void drawFillRect( Int startX, Int startY, Int width, Int height, - UnsignedInt color ); + UnsignedInt color ) override; /// Draw a percentage of a rectangle, much like a clock - virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { } - virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { } + virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) override { } + virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) override { } /// draw an image fit within the screen coordinates virtual void drawImage( const Image *image, Int startX, Int startY, - Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA); + Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA) override; /// image clipping support - virtual void setClipRegion( IRegion2D *region ); - virtual Bool isClippingEnabled( void ); - virtual void enableClipping( Bool onoff ); + virtual void setClipRegion( IRegion2D *region ) override; + virtual Bool isClippingEnabled( void ) override; + virtual void enableClipping( Bool onoff ) override; // These are stub functions to allow compilation: /// Create a video buffer that can be used for this display - virtual VideoBuffer* createVideoBuffer( void ) { return nullptr; } + virtual VideoBuffer* createVideoBuffer( void ) override { return nullptr; } /// draw a video buffer fit within the screen coordinates - virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) { } + virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) override { } virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY, - Int endX, Int endY ) { } - virtual void takeScreenShot(void){ } - virtual void toggleMovieCapture(void) {} + Int endX, Int endY ) override { } + virtual void takeScreenShot(void) override { } + virtual void toggleMovieCapture(void) override {} // methods that we need to stub - virtual void setTimeOfDay( TimeOfDay tod ) {} + virtual void setTimeOfDay( TimeOfDay tod ) override {} virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius, Real attenuationWidth, - UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime ) {} - virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting) {} - void setBorderShroudLevel(UnsignedByte level){} - virtual void clearShroud() {} - virtual void preloadModelAssets( AsciiString model ) {} - virtual void preloadTextureAssets( AsciiString texture ) {} - virtual void toggleLetterBox(void) {} - virtual void enableLetterBox(Bool enable) {} + UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime ) override {} + virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting) override {} + virtual void setBorderShroudLevel(UnsignedByte level) override {} + virtual void clearShroud() override {} + virtual void preloadModelAssets( AsciiString model ) override {} + virtual void preloadTextureAssets( AsciiString texture ) override {} + virtual void toggleLetterBox(void) override {} + virtual void enableLetterBox(Bool enable) override {} #if defined(RTS_DEBUG) virtual void dumpModelAssets(const char *path) {} #endif - virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) {} + virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) override {} #if defined(RTS_DEBUG) virtual void dumpAssetUsage(const char* mapname) {} #endif - virtual Real getAverageFPS(void) { return 0; } - virtual Real getCurrentFPS(void) { return 0; } - virtual Int getLastFrameDrawCalls( void ) { return 0; } + virtual Real getAverageFPS(void) override { return 0; } + virtual Real getCurrentFPS(void) override { return 0; } + virtual Int getLastFrameDrawCalls( void ) override { return 0; } protected: diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h index bb140e534ca..abc63a60676 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h @@ -46,16 +46,16 @@ class GUIEditWindowManager : public W3DGameWindowManager public: GUIEditWindowManager( void ); - virtual ~GUIEditWindowManager( void ); + virtual ~GUIEditWindowManager( void ) override; - virtual void init( void ); ///< initialize system + virtual void init( void ) override; ///< initialize system - virtual Int winDestroy( GameWindow *window ); ///< destroy this window + virtual Int winDestroy( GameWindow *window ) override; ///< destroy this window /// create a new window by setting up parameters and callbacks virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, Int x, Int y, Int width, Int height, GameWinSystemFunc system, - WinInstanceData *instData = nullptr ); + WinInstanceData *instData = nullptr ) override; // ************************************************************************** // GUIEdit specific methods ************************************************* @@ -93,7 +93,7 @@ class GUIEditWindowManager : public W3DGameWindowManager and become adults (their parent will be null, otherwise the screen) */ // void orphanSelectedChildren( void ); - /// dupe a window and its children + /// dupe a window and its children GameWindow *duplicateWindow( GameWindow *source, GameWindow *parent ); void createClipboardDuplicate( void ); ///< duplicate the clipboard on the dup list diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h b/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h index bbe9c0b0083..29c1c0c2e10 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h @@ -139,19 +139,19 @@ class HierarchyView #if USE_FAST_FIND_ITEM typedef const GameWindow* ConstGameWindowPtr; - // use special class for hashing, since std::hash won't compile for arbitrary ptrs - struct hashConstGameWindowPtr - { - size_t operator()(ConstGameWindowPtr p) const - { - std::hash hasher; - return hasher((UnsignedInt)p); - } - }; - - typedef std::hash_map< ConstGameWindowPtr, HTREEITEM, hashConstGameWindowPtr, std::equal_to > TreeHash; - - TreeHash m_treeHash; ///< Speed up the search with a nice hash. + // use special class for hashing, since std::hash won't compile for arbitrary ptrs + struct hashConstGameWindowPtr + { + size_t operator()(ConstGameWindowPtr p) const + { + std::hash hasher; + return hasher((UnsignedInt)p); + } + }; + + typedef std::hash_map< ConstGameWindowPtr, HTREEITEM, hashConstGameWindowPtr, std::equal_to > TreeHash; + + TreeHash m_treeHash; ///< Speed up the search with a nice hash. #endif diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp index 8e31952351d..ab51326ef2d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp @@ -306,14 +306,14 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { Int notifyCode = HIWORD( wParam ); // notification code // Int controlID = LOWORD( wParam ); // control ID HWND hWndControl = (HWND)lParam; // control window handle - switch( LOWORD( wParam ) ) - { + switch( LOWORD( wParam ) ) + { // -------------------------------------------------------------------- case LIST_WINDOWS: @@ -356,7 +356,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { // save callbacks, set current window to empty and end dialog @@ -369,21 +369,21 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, // end dialog EndDialog( hWndDialog, TRUE ); - break; + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp index 767796931b2..295787f87d3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp @@ -88,17 +88,17 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -162,32 +162,32 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -195,7 +195,7 @@ static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp index 57a0b8e0bf1..f61cc4267c2 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp @@ -85,75 +85,75 @@ static ICoord2D displayPos; // where to open window // ============================================================================ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) { - Real max, min; // max and min of rgb - Real red, green, blue; // rgb alias - Real hue, saturation, value; // hsv alias - HSVColorReal hsvColor; - - red = rgbColor.red; - green = rgbColor.green; - blue = rgbColor.blue; - - // find the max and min of the rgb triplet - max = red; - if (green > max) - max = green; - if (blue > max) - max = blue; - - min = red; - if (green < red) - min = green; - if (blue < min) - min = blue; - - // set the value - value = max; - - // calculate saturation - if (max != 0) - saturation = (max - min) / max; - else - saturation = 0; // saturation is 0 if all RGB are 0 - - // calculate hue - if (saturation == 0) { - hue = 0; // hue is really undefined - } - else { // chromatic case, determine hue - Real delta = max - min; - - if (red == max) - hue = (green - blue) / delta; // color between yellow and magenta - else if (green == max) - hue = 2 + (blue - red) / delta; // color between cyan and yellow - else if (blue == max) - hue = 4 + (red - green) / delta; // color between magenta and cyan - - hue = hue * 60; // convert hue to degrees - if (hue < 0) - hue += 360; // make sure hue is non negative - - } - - // set and return an HSVColor - hsvColor.hue = hue; - hsvColor.saturation = saturation; - hsvColor.value = value; - - // values aren't very nice to lets make them at least 1 ... isn't not - // technically correct but it works nicer for light color dialog - if (hsvColor.hue == 0.0f) - hsvColor.hue = 1.0f; - if (hsvColor.saturation == 0.0f) - hsvColor.saturation += 0.01f; - if (hsvColor.value == 0.0f) - hsvColor.value += 0.01f; + Real max, min; // max and min of rgb + Real red, green, blue; // rgb alias + Real hue, saturation, value; // hsv alias + HSVColorReal hsvColor; + + red = rgbColor.red; + green = rgbColor.green; + blue = rgbColor.blue; + + // find the max and min of the rgb triplet + max = red; + if (green > max) + max = green; + if (blue > max) + max = blue; + + min = red; + if (green < red) + min = green; + if (blue < min) + min = blue; + + // set the value + value = max; + + // calculate saturation + if (max != 0) + saturation = (max - min) / max; + else + saturation = 0; // saturation is 0 if all RGB are 0 + + // calculate hue + if (saturation == 0) { + hue = 0; // hue is really undefined + } + else { // chromatic case, determine hue + Real delta = max - min; + + if (red == max) + hue = (green - blue) / delta; // color between yellow and magenta + else if (green == max) + hue = 2 + (blue - red) / delta; // color between cyan and yellow + else if (blue == max) + hue = 4 + (red - green) / delta; // color between magenta and cyan + + hue = hue * 60; // convert hue to degrees + if (hue < 0) + hue += 360; // make sure hue is non negative + + } + + // set and return an HSVColor + hsvColor.hue = hue; + hsvColor.saturation = saturation; + hsvColor.value = value; + + // values aren't very nice to lets make them at least 1 ... isn't not + // technically correct but it works nicer for light color dialog + if (hsvColor.hue == 0.0f) + hsvColor.hue = 1.0f; + if (hsvColor.saturation == 0.0f) + hsvColor.saturation += 0.01f; + if (hsvColor.value == 0.0f) + hsvColor.value += 0.01f; // copy over alpha hsvColor.alpha = rgbColor.alpha; - return hsvColor; + return hsvColor; } @@ -165,82 +165,82 @@ HSVColorReal rgbToHSV( RGBColorReal rgbColor ) // ============================================================================ RGBColorReal hsvToRGB( HSVColorReal hsvColor ) { - Int i; - Real f, p, q, t; - Real red, green, blue; // rgb alias - Real hue, saturation, value; // hsv alias - RGBColorReal rgbColor; + Int i; + Real f, p, q, t; + Real red, green, blue; // rgb alias + Real hue, saturation, value; // hsv alias + RGBColorReal rgbColor; - hue = hsvColor.hue; - saturation = hsvColor.saturation; - value = hsvColor.value; + hue = hsvColor.hue; + saturation = hsvColor.saturation; + value = hsvColor.value; - if( saturation == 0.0f ) + if( saturation == 0.0f ) { // the colors is on the black and white center line - if( hue == 0.0f ) + if( hue == 0.0f ) { // achromatic color ... there is no hue - red = green = blue = value; - } - else + red = green = blue = value; + } + else { - DEBUG_LOG(( "HSVToRGB error, hue should be undefined" )); - } + DEBUG_LOG(( "HSVToRGB error, hue should be undefined" )); + } - } - else + } + else { - if( hue == 360.0f ) - hue = 0.0f; - hue = hue / 60.0f; // h is now in [0, 6) - i = REAL_TO_INT_FLOOR(hue); // largest int <= h - f = hue - (Real) i; // f is the fractional part of h - p = value * (1.0f - saturation); - q = value * (1.0f - (saturation * f)); - t = value * (1.0f - (saturation * (1.0f - f))); - switch (i) { - case 0: - red = value; - green = t; - blue = p; - break; - case 1: - red = q; - green = value; - blue = p; - break; - case 2: - red = p; - green = value; - blue = t; - break; - case 3: - red = p; - green = q; - blue = value; - break; - case 4: - red = t; - green = p; - blue = value; - break; - case 5: - red = value; - green = p; - blue = q; - break; - } - - } - - // store and return and RGB color - rgbColor.red = red; - rgbColor.green = green; - rgbColor.blue = blue; - rgbColor.alpha = hsvColor.alpha; - - return rgbColor; + if( hue == 360.0f ) + hue = 0.0f; + hue = hue / 60.0f; // h is now in [0, 6) + i = REAL_TO_INT_FLOOR(hue); // largest int <= h + f = hue - (Real) i; // f is the fractional part of h + p = value * (1.0f - saturation); + q = value * (1.0f - (saturation * f)); + t = value * (1.0f - (saturation * (1.0f - f))); + switch (i) { + case 0: + red = value; + green = t; + blue = p; + break; + case 1: + red = q; + green = value; + blue = p; + break; + case 2: + red = p; + green = value; + blue = t; + break; + case 3: + red = p; + green = q; + blue = value; + break; + case 4: + red = t; + green = p; + blue = value; + break; + case 5: + red = value; + green = p; + blue = q; + break; + } + + } + + // store and return and RGB color + rgbColor.red = red; + rgbColor.green = green; + rgbColor.blue = blue; + rgbColor.alpha = hsvColor.alpha; + + return rgbColor; } @@ -264,19 +264,19 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, Int mouseX, Int mouseY ) { - selectedColor.red = red; - selectedColor.green = green; - selectedColor.blue = blue; + selectedColor.red = red; + selectedColor.green = green; + selectedColor.blue = blue; selectedColor.alpha = alpha; displayPos.x = mouseX; displayPos.y = mouseY; - if( DialogBox( TheEditor->getInstance(), (LPCTSTR)COLOR_SELECT_DIALOG, + if( DialogBox( TheEditor->getInstance(), (LPCTSTR)COLOR_SELECT_DIALOG, TheEditor->getWindowHandle(), SelectColorDlgProc ) ) return &selectedColor; - else - return nullptr; + else + return nullptr; } @@ -286,32 +286,32 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - static HWND hWndScrollColor1; // red / hue - static HWND hWndScrollColor2; // green / saturation - static HWND hWndScrollColor3; // blue / value + static HWND hWndScrollColor1; // red / hue + static HWND hWndScrollColor2; // green / saturation + static HWND hWndScrollColor3; // blue / value static HWND hWndScrollAlpha; // alpha scrollbar - static HWND hWndColorBar1; // red / hue - static HWND hWndColorBar2; // green / saturation - static HWND hWndColorBar3; // blue / value - static HWND hWndPreview; + static HWND hWndColorBar1; // red / hue + static HWND hWndColorBar2; // green / saturation + static HWND hWndColorBar3; // blue / value + static HWND hWndPreview; - switch (uMsg) { + switch (uMsg) { - // ------------------------------------------------------------------------ - case WM_INITDIALOG: + // ------------------------------------------------------------------------ + case WM_INITDIALOG: { - // save some window handles for later comparing during processing - hWndScrollColor1 = GetDlgItem( hWndDlg, SCROLL_COLOR1 ); - hWndScrollColor2 = GetDlgItem( hWndDlg, SCROLL_COLOR2 ); - hWndScrollColor3 = GetDlgItem( hWndDlg, SCROLL_COLOR3 ); + // save some window handles for later comparing during processing + hWndScrollColor1 = GetDlgItem( hWndDlg, SCROLL_COLOR1 ); + hWndScrollColor2 = GetDlgItem( hWndDlg, SCROLL_COLOR2 ); + hWndScrollColor3 = GetDlgItem( hWndDlg, SCROLL_COLOR3 ); hWndScrollAlpha = GetDlgItem( hWndDlg, SCROLL_ALPHA ); - hWndColorBar1 = GetDlgItem( hWndDlg, BUTTON_COLORBAR1 ); - hWndColorBar2 = GetDlgItem( hWndDlg, BUTTON_COLORBAR2 ); - hWndColorBar3 = GetDlgItem( hWndDlg, BUTTON_COLORBAR3 ); - hWndPreview = GetDlgItem (hWndDlg, BUTTON_PREVIEW); + hWndColorBar1 = GetDlgItem( hWndDlg, BUTTON_COLORBAR1 ); + hWndColorBar2 = GetDlgItem( hWndDlg, BUTTON_COLORBAR2 ); + hWndColorBar3 = GetDlgItem( hWndDlg, BUTTON_COLORBAR3 ); + hWndPreview = GetDlgItem (hWndDlg, BUTTON_PREVIEW); - // init the scroll bars and labels to the current color + // init the scroll bars and labels to the current color if (mode == MODE_HSV) { RGBColorReal rgbColor; @@ -345,29 +345,29 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, SetDlgItemInt (hWndDlg, LABEL_ALPHA, (Int) hsvColor.alpha, FALSE); - } - else + } + else { - // init the RGB and intensity scroll bar extents - SendMessage( hWndScrollColor1, SBM_SETRANGE, 1, 255 ); - SendMessage( hWndScrollColor2, SBM_SETRANGE, 1, 255 ); - SendMessage( hWndScrollColor3, SBM_SETRANGE, 1, 255 ); + // init the RGB and intensity scroll bar extents + SendMessage( hWndScrollColor1, SBM_SETRANGE, 1, 255 ); + SendMessage( hWndScrollColor2, SBM_SETRANGE, 1, 255 ); + SendMessage( hWndScrollColor3, SBM_SETRANGE, 1, 255 ); SendMessage( hWndScrollAlpha, SBM_SETRANGE, 0, 255 ); - SetScrollPos (hWndScrollColor1, SB_CTL, selectedColor.red, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR1, + SetScrollPos (hWndScrollColor1, SB_CTL, selectedColor.red, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR1, selectedColor.red, FALSE); - SetScrollPos (hWndScrollColor2, SB_CTL, selectedColor.green, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR2, + SetScrollPos (hWndScrollColor2, SB_CTL, selectedColor.green, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR2, selectedColor.green, FALSE); - SetScrollPos (hWndScrollColor3, SB_CTL, selectedColor.blue, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR3, + SetScrollPos (hWndScrollColor3, SB_CTL, selectedColor.blue, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR3, selectedColor.blue, FALSE); - SetScrollPos (hWndScrollAlpha, SB_CTL, selectedColor.alpha, TRUE); - SetDlgItemInt (hWndDlg, LABEL_ALPHA, + SetScrollPos (hWndScrollAlpha, SB_CTL, selectedColor.alpha, TRUE); + SetDlgItemInt (hWndDlg, LABEL_ALPHA, selectedColor.alpha, FALSE); - } + } // // move the window to the display position, but keep the whole @@ -375,542 +375,542 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // PositionWindowOnScreen( hWndDlg, displayPos.x, displayPos.y ); - return TRUE; + return TRUE; - } + } - // ------------------------------------------------------------------------ - case WM_DRAWITEM: { - UINT idCtl = (UINT) wParam; // control identifier - LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) lParam; // item drawing - HWND hWndControl; - RECT rect; - ICoord2D center; - Int radius; + // ------------------------------------------------------------------------ + case WM_DRAWITEM: { + UINT idCtl = (UINT) wParam; // control identifier + LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) lParam; // item drawing + HWND hWndControl; + RECT rect; + ICoord2D center; + Int radius; - // Get the area we have to draw in - hWndControl = GetDlgItem (hWndDlg, idCtl); - GetClientRect (hWndControl, &rect); - center.x = (rect.right - rect.left) / 2; - center.y = (rect.bottom - rect.top) / 2; + // Get the area we have to draw in + hWndControl = GetDlgItem (hWndDlg, idCtl); + GetClientRect (hWndControl, &rect); + center.x = (rect.right - rect.left) / 2; + center.y = (rect.bottom - rect.top) / 2; - // record radius we have to work with - radius = (rect.right - rect.left) / 2; + // record radius we have to work with + radius = (rect.right - rect.left) / 2; - switch (idCtl) { + switch (idCtl) { - case BUTTON_PREVIEW: { - RGBColorReal rgbColor; - HSVColorReal hsvColor; - HBRUSH hBrushOld, hBrushNew; + case BUTTON_PREVIEW: { + RGBColorReal rgbColor; + HSVColorReal hsvColor; + HBRUSH hBrushOld, hBrushNew; - if (mode == MODE_RGB) { - rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + if (mode == MODE_RGB) { + rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, + rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, + rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); - } - else { - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + } + else { + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, + hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); - // convert to ranges 0 - 1 for RGB conversion - hsvColor.saturation /= 100.0f; - hsvColor.value /= 100.0f; - rgbColor = hsvToRGB (hsvColor); - // convert RGB ranges to 0 - 255 - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - - // create a new brush and select it into DC - hBrushNew = CreateSolidBrush (RGB ((BYTE) rgbColor.red, + // convert to ranges 0 - 1 for RGB conversion + hsvColor.saturation /= 100.0f; + hsvColor.value /= 100.0f; + rgbColor = hsvToRGB (hsvColor); + // convert RGB ranges to 0 - 255 + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + + // create a new brush and select it into DC + hBrushNew = CreateSolidBrush (RGB ((BYTE) rgbColor.red, (BYTE) rgbColor.green, (BYTE) rgbColor.blue)); - hBrushOld = (HBRUSH)SelectObject( lpdis->hDC, hBrushNew ); + hBrushOld = (HBRUSH)SelectObject( lpdis->hDC, hBrushNew ); - // draw the rectangle - Rectangle (lpdis->hDC, rect.left, rect.top, + // draw the rectangle + Rectangle (lpdis->hDC, rect.left, rect.top, rect.right, rect.bottom); - // put the old brush back and delete the new one - SelectObject (lpdis->hDC, hBrushOld); - DeleteObject (hBrushNew); - - // validate this new area - ValidateRect (hWndControl, nullptr); - - break; - - } - - // -------------------------------------------------------------------- - // Draw the bar of either HUE or RED next to the scroll bar - // -------------------------------------------------------------------- - case BUTTON_COLORBAR1: { - Real step; - Int x, y; - RGBColorReal rgbColor; - HSVColorReal hsvColor; - - // compute how big of a red increment for each line as we step - // down the bar - if (mode == MODE_HSV) - step = 360.0f / (Real) (rect.right - rect.left); - else - step = 255.0f / (Real) (rect.right - rect.left); - - // compute the first color, create pen for it, and save the - // original pen - if (mode == MODE_HSV) { - hsvColor.hue = 1; - hsvColor.saturation = 1; - hsvColor.value = 1; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255.0f; - rgbColor.green *= 255.0f; - rgbColor.blue *= 255.0f; - } - else { - rgbColor.red = 0; - rgbColor.green = 0; - rgbColor.blue = 0; - } - - // loop through each horizontal line available in the bar drawing - // the correct color there - for (x = 0; x < (rect.right - rect.left) - 1; x++) { - - // draw a horizontal row of pixels with this color - for (y = 0; y < rect.bottom; y++) - SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, + // put the old brush back and delete the new one + SelectObject (lpdis->hDC, hBrushOld); + DeleteObject (hBrushNew); + + // validate this new area + ValidateRect (hWndControl, nullptr); + + break; + + } + + // -------------------------------------------------------------------- + // Draw the bar of either HUE or RED next to the scroll bar + // -------------------------------------------------------------------- + case BUTTON_COLORBAR1: { + Real step; + Int x, y; + RGBColorReal rgbColor; + HSVColorReal hsvColor; + + // compute how big of a red increment for each line as we step + // down the bar + if (mode == MODE_HSV) + step = 360.0f / (Real) (rect.right - rect.left); + else + step = 255.0f / (Real) (rect.right - rect.left); + + // compute the first color, create pen for it, and save the + // original pen + if (mode == MODE_HSV) { + hsvColor.hue = 1; + hsvColor.saturation = 1; + hsvColor.value = 1; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255.0f; + rgbColor.green *= 255.0f; + rgbColor.blue *= 255.0f; + } + else { + rgbColor.red = 0; + rgbColor.green = 0; + rgbColor.blue = 0; + } + + // loop through each horizontal line available in the bar drawing + // the correct color there + for (x = 0; x < (rect.right - rect.left) - 1; x++) { + + // draw a horizontal row of pixels with this color + for (y = 0; y < rect.bottom; y++) + SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, (BYTE) rgbColor.green, (BYTE) rgbColor.blue)); - // increment the color, create new pen, and delete old pen - if (mode == MODE_HSV) { - hsvColor.hue += step; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - else { - rgbColor.red += step; - } - - } - - break; - - } - - // -------------------------------------------------------------------- - // Draw the bar of either SATURATION or GREEN next to the scroll bar - // -------------------------------------------------------------------- - case BUTTON_COLORBAR2: { - Real step; - Int x, y; - RGBColorReal rgbColor; - HSVColorReal hsvColor; - - // compute how big of a increment for each line as we step - // down the bar - if (mode == MODE_HSV) - step = 1.0f / (Real) (rect.right - rect.left); - else - step = 255.0f / (Real) (rect.right - rect.left); - - // compute the first color, create pen for it, and save the - // original pen - if (mode == MODE_HSV) { - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + // increment the color, create new pen, and delete old pen + if (mode == MODE_HSV) { + hsvColor.hue += step; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + else { + rgbColor.red += step; + } + + } + + break; + + } + + // -------------------------------------------------------------------- + // Draw the bar of either SATURATION or GREEN next to the scroll bar + // -------------------------------------------------------------------- + case BUTTON_COLORBAR2: { + Real step; + Int x, y; + RGBColorReal rgbColor; + HSVColorReal hsvColor; + + // compute how big of a increment for each line as we step + // down the bar + if (mode == MODE_HSV) + step = 1.0f / (Real) (rect.right - rect.left); + else + step = 255.0f / (Real) (rect.right - rect.left); + + // compute the first color, create pen for it, and save the + // original pen + if (mode == MODE_HSV) { + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - hsvColor.saturation = 1.0f / 100.0f; - hsvColor.value = 1; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - else { - rgbColor.red = 0; - rgbColor.green = 0; - rgbColor.blue = 0; - } - - // loop through each horizontal line available in the bar drawing - // the correct color there - for (x = 0; x < (rect.right - rect.left) - 1; x++) { - - // draw a horizontal row of pixels with this color - for (y = 0; y < rect.bottom; y++) - SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, + hsvColor.saturation = 1.0f / 100.0f; + hsvColor.value = 1; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + else { + rgbColor.red = 0; + rgbColor.green = 0; + rgbColor.blue = 0; + } + + // loop through each horizontal line available in the bar drawing + // the correct color there + for (x = 0; x < (rect.right - rect.left) - 1; x++) { + + // draw a horizontal row of pixels with this color + for (y = 0; y < rect.bottom; y++) + SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, (BYTE) rgbColor.green, (BYTE) rgbColor.blue)); - // increment the color, create new pen, and delete old pen - if (mode == MODE_HSV) { - hsvColor.saturation += step; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - else { - rgbColor.green += step; - } - - } - - break; - - } - - // -------------------------------------------------------------------- - // Draw the bar of either VALUE or BLUE next to the scroll bar - // -------------------------------------------------------------------- - case BUTTON_COLORBAR3: { - Real step; - Int x, y; - RGBColorReal rgbColor; - HSVColorReal hsvColor; - - // compute how big of a increment for each line as we step - // down the bar - if (mode == MODE_HSV) - step = 1.0f / (Real) (rect.right - rect.left); - else - step = 255.0f / (Real) (rect.right - rect.left); - - // compute the first color, create pen for it, and save the - // original pen - if (mode == MODE_HSV) { - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + // increment the color, create new pen, and delete old pen + if (mode == MODE_HSV) { + hsvColor.saturation += step; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + else { + rgbColor.green += step; + } + + } + + break; + + } + + // -------------------------------------------------------------------- + // Draw the bar of either VALUE or BLUE next to the scroll bar + // -------------------------------------------------------------------- + case BUTTON_COLORBAR3: { + Real step; + Int x, y; + RGBColorReal rgbColor; + HSVColorReal hsvColor; + + // compute how big of a increment for each line as we step + // down the bar + if (mode == MODE_HSV) + step = 1.0f / (Real) (rect.right - rect.left); + else + step = 255.0f / (Real) (rect.right - rect.left); + + // compute the first color, create pen for it, and save the + // original pen + if (mode == MODE_HSV) { + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - hsvColor.saturation = + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE) / 100.0f; - hsvColor.value = 1.0f / 100.0f; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255.0f; - rgbColor.green *= 255.0f; - rgbColor.blue *= 255.0f; - } - else { - rgbColor.red = 0; - rgbColor.green = 0; - rgbColor.blue = 0; - } - - // loop through each horizontal line available in the bar drawing - // the correct color there - for (x = 0; x < (rect.right - rect.left) - 1; x++) { - - // draw a horizontal row of pixels with this color - for (y = 0; y < rect.bottom; y++) - SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, + hsvColor.value = 1.0f / 100.0f; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255.0f; + rgbColor.green *= 255.0f; + rgbColor.blue *= 255.0f; + } + else { + rgbColor.red = 0; + rgbColor.green = 0; + rgbColor.blue = 0; + } + + // loop through each horizontal line available in the bar drawing + // the correct color there + for (x = 0; x < (rect.right - rect.left) - 1; x++) { + + // draw a horizontal row of pixels with this color + for (y = 0; y < rect.bottom; y++) + SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red, (BYTE) rgbColor.green, (BYTE) rgbColor.blue)); - // increment the color, create new pen, and delete old pen - if (mode == MODE_HSV) { - hsvColor.value += step; - rgbColor = hsvToRGB (hsvColor); - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - else { - rgbColor.blue += step; - } + // increment the color, create new pen, and delete old pen + if (mode == MODE_HSV) { + hsvColor.value += step; + rgbColor = hsvToRGB (hsvColor); + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + else { + rgbColor.blue += step; + } - } + } - break; + break; - } + } - } + } - return TRUE; + return TRUE; - } + } - // ------------------------------------------------------------------------ - // horizontal scrolling on the color bars - // ------------------------------------------------------------------------ - case WM_HSCROLL: + // ------------------------------------------------------------------------ + // horizontal scrolling on the color bars + // ------------------------------------------------------------------------ + case WM_HSCROLL: { - Int nScrollCode = (Int) LOWORD (wParam); // scroll bar value - Short nPos = (Short) HIWORD (wParam); // for thumbtrack only - HWND hWndScroll = (HWND) lParam; // handle of scroll bar - Int labelID; // identifier of the text label for this scroll bar - Int thumbPos; // current thumb position - Int minPos, maxPos; // max and min of this scrollbar - - // get the thumb position for the scrollbar - thumbPos = GetScrollPos (hWndScroll, SB_CTL); - - // find out which scroll bar we're talking about and set the correct - // labelID for that control - if (hWndScroll == hWndScrollColor1) - labelID = LABEL_COLOR1; - else if (hWndScroll == hWndScrollColor2) - labelID = LABEL_COLOR2; - else if (hWndScroll == hWndScrollColor3) - labelID = LABEL_COLOR3; + Int nScrollCode = (Int) LOWORD (wParam); // scroll bar value + Short nPos = (Short) HIWORD (wParam); // for thumbtrack only + HWND hWndScroll = (HWND) lParam; // handle of scroll bar + Int labelID; // identifier of the text label for this scroll bar + Int thumbPos; // current thumb position + Int minPos, maxPos; // max and min of this scrollbar + + // get the thumb position for the scrollbar + thumbPos = GetScrollPos (hWndScroll, SB_CTL); + + // find out which scroll bar we're talking about and set the correct + // labelID for that control + if (hWndScroll == hWndScrollColor1) + labelID = LABEL_COLOR1; + else if (hWndScroll == hWndScrollColor2) + labelID = LABEL_COLOR2; + else if (hWndScroll == hWndScrollColor3) + labelID = LABEL_COLOR3; else if( hWndScroll == hWndScrollAlpha ) labelID = LABEL_ALPHA; - // find the max and min extents for this scroll bar - SendMessage (hWndScroll, SBM_GETRANGE, (WPARAM) &minPos, (LPARAM) &maxPos); - - switch (nScrollCode) { - case SB_LINELEFT: { - if (thumbPos > minPos) - thumbPos--; - break; - } - case SB_PAGELEFT: { - if (thumbPos - 45 >= minPos) - thumbPos -= 45; - else - thumbPos = minPos; - break; - } - case SB_LINERIGHT: { - if (thumbPos < maxPos) - thumbPos++; - break; - } - case SB_PAGERIGHT: { - if (thumbPos + 45 < maxPos) - thumbPos += 45; - else - thumbPos = maxPos; - break; - } - case SB_THUMBTRACK: { - thumbPos = nPos; - break; - } - default: { - return 0; - } - } - - // set the new scrollbar position and the text with it - SendMessage (hWndScroll, SBM_SETPOS, (WPARAM) thumbPos, (LPARAM) TRUE); - SetDlgItemInt (hWndDlg, labelID, thumbPos, FALSE); - - // if this was a color scroll bar, save the color change in - // the appropriate color bead - if (hWndScroll == hWndScrollColor1 || + // find the max and min extents for this scroll bar + SendMessage (hWndScroll, SBM_GETRANGE, (WPARAM) &minPos, (LPARAM) &maxPos); + + switch (nScrollCode) { + case SB_LINELEFT: { + if (thumbPos > minPos) + thumbPos--; + break; + } + case SB_PAGELEFT: { + if (thumbPos - 45 >= minPos) + thumbPos -= 45; + else + thumbPos = minPos; + break; + } + case SB_LINERIGHT: { + if (thumbPos < maxPos) + thumbPos++; + break; + } + case SB_PAGERIGHT: { + if (thumbPos + 45 < maxPos) + thumbPos += 45; + else + thumbPos = maxPos; + break; + } + case SB_THUMBTRACK: { + thumbPos = nPos; + break; + } + default: { + return 0; + } + } + + // set the new scrollbar position and the text with it + SendMessage (hWndScroll, SBM_SETPOS, (WPARAM) thumbPos, (LPARAM) TRUE); + SetDlgItemInt (hWndDlg, labelID, thumbPos, FALSE); + + // if this was a color scroll bar, save the color change in + // the appropriate color bead + if (hWndScroll == hWndScrollColor1 || hWndScroll == hWndScrollColor2 || hWndScroll == hWndScrollColor3 || hWndScroll == hWndScrollAlpha ) { - RGBColorReal rgbColor; - HSVColorReal hsvColor; + RGBColorReal rgbColor; + HSVColorReal hsvColor; - if (mode == MODE_RGB) { - rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + if (mode == MODE_RGB) { + rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, + rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, + rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, nullptr, FALSE ); - } - else { - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, + } + else { + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, + hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); hsvColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, nullptr, FALSE ); - // convert to ranges 0 - 1 for RGB conversion - hsvColor.saturation /= 100.0f; - hsvColor.value /= 100.0f; - rgbColor = hsvToRGB (hsvColor); - // convert RGB ranges to 0 - 255 - rgbColor.red *= 255; - rgbColor.green *= 255; - rgbColor.blue *= 255; - } - - // store the color - selectedColor.red = (Int) rgbColor.red; - selectedColor.green = (Int) rgbColor.green; - selectedColor.blue = (Int) rgbColor.blue; + // convert to ranges 0 - 1 for RGB conversion + hsvColor.saturation /= 100.0f; + hsvColor.value /= 100.0f; + rgbColor = hsvToRGB (hsvColor); + // convert RGB ranges to 0 - 255 + rgbColor.red *= 255; + rgbColor.green *= 255; + rgbColor.blue *= 255; + } + + // store the color + selectedColor.red = (Int) rgbColor.red; + selectedColor.green = (Int) rgbColor.green; + selectedColor.blue = (Int) rgbColor.blue; selectedColor.alpha = (Int) rgbColor.alpha; - // force update of preview box - // invalidate the preview box to force an update of its color - InvalidateRect( hWndPreview, nullptr, FALSE); - UpdateWindow (hWndPreview); + // force update of preview box + // invalidate the preview box to force an update of its color + InvalidateRect( hWndPreview, nullptr, FALSE); + UpdateWindow (hWndPreview); - // force updates of the colorbars - InvalidateRect (hWndColorBar1, nullptr, FALSE); - InvalidateRect (hWndColorBar2, nullptr, FALSE); - InvalidateRect (hWndColorBar3, nullptr, FALSE); - UpdateWindow (hWndColorBar1); - UpdateWindow (hWndColorBar2); - UpdateWindow (hWndColorBar3); + // force updates of the colorbars + InvalidateRect (hWndColorBar1, nullptr, FALSE); + InvalidateRect (hWndColorBar2, nullptr, FALSE); + InvalidateRect (hWndColorBar3, nullptr, FALSE); + UpdateWindow (hWndColorBar1); + UpdateWindow (hWndColorBar2); + UpdateWindow (hWndColorBar3); - } + } - return 0; + return 0; - } + } - // ------------------------------------------------------------------------ - case WM_COMMAND: { + // ------------------------------------------------------------------------ + case WM_COMMAND: { // Int wNotifyCode = HIWORD(wParam); // notification code - Int wID = LOWORD(wParam); // id of control + Int wID = LOWORD(wParam); // id of control // HWND hWndControl = (HWND) lParam; // handle of control - switch (wID) { - - // -------------------------------------------------------------------- - // color ok - // -------------------------------------------------------------------- - case IDOK: { - - EndDialog( hWndDlg, TRUE ); // color selected - break; - - } - - // -------------------------------------------------------------------- - case IDCANCEL: { - - EndDialog( hWndDlg, FALSE ); // selection cancelled - break; - - } - - // -------------------------------------------------------------------- - // Change from RGB mode to HSV mode and vice versa - // -------------------------------------------------------------------- - case BUTTON_RGB_HSV: { - HWND hWndScroll; - RGBColorReal rgbColor; - HSVColorReal hsvColor; - - if (mode == MODE_RGB) { // switch to HSV - rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); - - // convert rgb to range 0 - 1 - rgbColor.red /= 255.0f; - rgbColor.green /= 255.0f; - rgbColor.blue /= 255.0f; - // convert the RGB to HSV - hsvColor = rgbToHSV (rgbColor); - // turn saturation and value to 0 - 100 ranges - hsvColor.saturation *= 100.0f; - hsvColor.value *= 100.0f; - - // change the scrollbar extents and positions - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1); - SetScrollRange (hWndScroll, SB_CTL, 1, 360, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.hue, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) hsvColor.hue, FALSE); - - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2); - SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.saturation, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) hsvColor.saturation, FALSE); - - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3); - SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.value, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) hsvColor.value, FALSE); - - mode = MODE_HSV; - - // change the text for the button - SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), + switch (wID) { + + // -------------------------------------------------------------------- + // color ok + // -------------------------------------------------------------------- + case IDOK: { + + EndDialog( hWndDlg, TRUE ); // color selected + break; + + } + + // -------------------------------------------------------------------- + case IDCANCEL: { + + EndDialog( hWndDlg, FALSE ); // selection cancelled + break; + + } + + // -------------------------------------------------------------------- + // Change from RGB mode to HSV mode and vice versa + // -------------------------------------------------------------------- + case BUTTON_RGB_HSV: { + HWND hWndScroll; + RGBColorReal rgbColor; + HSVColorReal hsvColor; + + if (mode == MODE_RGB) { // switch to HSV + rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); + + // convert rgb to range 0 - 1 + rgbColor.red /= 255.0f; + rgbColor.green /= 255.0f; + rgbColor.blue /= 255.0f; + // convert the RGB to HSV + hsvColor = rgbToHSV (rgbColor); + // turn saturation and value to 0 - 100 ranges + hsvColor.saturation *= 100.0f; + hsvColor.value *= 100.0f; + + // change the scrollbar extents and positions + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1); + SetScrollRange (hWndScroll, SB_CTL, 1, 360, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.hue, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) hsvColor.hue, FALSE); + + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2); + SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.saturation, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) hsvColor.saturation, FALSE); + + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3); + SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.value, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) hsvColor.value, FALSE); + + mode = MODE_HSV; + + // change the text for the button + SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), "Switch to RGB"); - } - else { // switch to RGB - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); - hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); - hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); - - // convert saturation and value to range 0 - 1 - hsvColor.saturation /= 100.0f; - hsvColor.value /= 100.0f; - // convert the HSV to RGB - rgbColor = hsvToRGB (hsvColor); - // turn the rgb into 0 - 255 range - rgbColor.red *= 255.0f; - rgbColor.green *= 255.0f; - rgbColor.blue *= 255.0f; - - // change the scrollbar extents and positions - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1); - SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.red, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) rgbColor.red, FALSE); - - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2); - SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.green, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) rgbColor.green, FALSE); - - hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3); - SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); - SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.blue, TRUE); - SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) rgbColor.blue, FALSE); - - // change the text for the button - SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), + } + else { // switch to RGB + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); + + // convert saturation and value to range 0 - 1 + hsvColor.saturation /= 100.0f; + hsvColor.value /= 100.0f; + // convert the HSV to RGB + rgbColor = hsvToRGB (hsvColor); + // turn the rgb into 0 - 255 range + rgbColor.red *= 255.0f; + rgbColor.green *= 255.0f; + rgbColor.blue *= 255.0f; + + // change the scrollbar extents and positions + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1); + SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.red, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) rgbColor.red, FALSE); + + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2); + SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.green, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) rgbColor.green, FALSE); + + hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3); + SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE); + SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.blue, TRUE); + SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) rgbColor.blue, FALSE); + + // change the text for the button + SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV), "Switch to HSV"); - mode = MODE_RGB; + mode = MODE_RGB; - } + } - // invalidate all the vertical color bars so they are redrawn - InvalidateRect (hWndColorBar1, nullptr, TRUE); - InvalidateRect (hWndColorBar2, nullptr, TRUE); - InvalidateRect (hWndColorBar3, nullptr, TRUE); + // invalidate all the vertical color bars so they are redrawn + InvalidateRect (hWndColorBar1, nullptr, TRUE); + InvalidateRect (hWndColorBar2, nullptr, TRUE); + InvalidateRect (hWndColorBar3, nullptr, TRUE); - } + } - } + } - return 0; + return 0; - } + } - // ------------------------------------------------------------------------ - // Only hide the window on a close rather than destroy it since it will - // probably be needed again. - // ------------------------------------------------------------------------ - case WM_CLOSE: - ShowWindow(hWndDlg, SW_HIDE); - return 0; + // ------------------------------------------------------------------------ + // Only hide the window on a close rather than destroy it since it will + // probably be needed again. + // ------------------------------------------------------------------------ + case WM_CLOSE: + ShowWindow(hWndDlg, SW_HIDE); + return 0; - default: - return 0; // for all messages that are not processed + default: + return 0; // for all messages that are not processed - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp index cb323c6d559..960f0dff4ff 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp @@ -96,14 +96,14 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_SUBCONTROL_COLOR: @@ -167,7 +167,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -553,32 +553,32 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -586,7 +586,7 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } @@ -670,7 +670,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) image = GadgetComboBoxGetHiliteSelectedItemImageSmallCenter( window ); StoreImageAndColor( COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED ); - GameWindow *listBox = GadgetComboBoxGetListBox( window ); + GameWindow *listBox = GadgetComboBoxGetListBox( window ); if (listBox) { image = GadgetListBoxGetEnabledSelectedItemImageLeft( listBox ); @@ -960,7 +960,7 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) } // init comboBox specific property section - ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); + ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); SetDlgItemInt(dialog, EDIT_MAX_CHARS, comboData->maxChars, true); SetDlgItemInt(dialog, EDIT_MAX_ITEMS_DISPLAYED, comboData->maxDisplay,true ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp index 67de9b50bdc..867e944ebdf 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp @@ -98,8 +98,8 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, // ------------------------------------------------------------------------ case WM_DRAWITEM: { - UINT controlID = (UINT)wParam; // control identifier - LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing + UINT controlID = (UINT)wParam; // control identifier + LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing RGBColorInt *color = GetControlColor( controlID ); // we only care about color button controls @@ -116,21 +116,21 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, // Get the area we have to draw in GetClientRect( hWndControl, &rect ); - // create a new brush and select it into DC - hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red, + // create a new brush and select it into DC + hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red, (BYTE)color->green, (BYTE)color->blue)); - hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); + hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); - // draw the rectangle - Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); + // draw the rectangle + Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); - // put the old brush back and delete the new one - SelectObject( drawItem->hDC, hBrushOld ); - DeleteObject( hBrushNew ); + // put the old brush back and delete the new one + SelectObject( drawItem->hDC, hBrushOld ); + DeleteObject( hBrushNew ); - // validate this new area - ValidateRect( hWndControl, nullptr ); + // validate this new area + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -142,14 +142,14 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_ENABLED_COLOR: @@ -190,7 +190,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -240,32 +240,32 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -273,7 +273,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp index fa10b0990d9..85a064290b0 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp @@ -121,8 +121,8 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, // ------------------------------------------------------------------------ case WM_DRAWITEM: { - UINT controlID = (UINT)wParam; // control identifier - LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing + UINT controlID = (UINT)wParam; // control identifier + LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing RGBColorInt *color = &gridColor; // we only care about color button controls @@ -139,21 +139,21 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, // Get the area we have to draw in GetClientRect( hWndControl, &rect ); - // create a new brush and select it into DC - hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red, + // create a new brush and select it into DC + hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red, (BYTE)color->green, (BYTE)color->blue)); - hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); + hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); - // draw the rectangle - Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); + // draw the rectangle + Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); - // put the old brush back and delete the new one - SelectObject( drawItem->hDC, hBrushOld ); - DeleteObject( hBrushNew ); + // put the old brush back and delete the new one + SelectObject( drawItem->hDC, hBrushOld ); + DeleteObject( hBrushNew ); - // validate this new area - ValidateRect( hWndControl, nullptr ); + // validate this new area + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -165,14 +165,14 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code // Int controlID = LOWORD( wParam ); // control ID HWND hWndControl = (HWND)lParam; // control window handle - switch( LOWORD( wParam ) ) - { + switch( LOWORD( wParam ) ) + { // -------------------------------------------------------------------- case BUTTON_COLOR: @@ -205,7 +205,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { Int value; @@ -227,31 +227,31 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, // end this dialog EndDialog( hWndDialog, TRUE ); - break; + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { EndDialog( hWndDialog, FALSE ); - break; + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { EndDialog( hWndDialog, FALSE ); - return 0; + return 0; } @@ -259,7 +259,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 5a96c39be6d..31da2a54bcd 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -274,14 +274,14 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_SUBCONTROL_COLOR: @@ -330,7 +330,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -650,32 +650,32 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -683,7 +683,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp index d325a3aa938..50a07eeae74 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/NewLayoutDialog.cpp @@ -101,14 +101,14 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { - switch( LOWORD( wParam ) ) - { + switch( LOWORD( wParam ) ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { // reset the editor @@ -117,31 +117,31 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, // end this dialog EndDialog( hWndDialog, TRUE ); - break; + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { EndDialog( hWndDialog, FALSE ); - break; + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { EndDialog( hWndDialog, FALSE ); - return 0; + return 0; } @@ -149,7 +149,7 @@ LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp index 0adc7fef900..9ead6bec325 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp @@ -88,17 +88,17 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -183,32 +183,32 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -216,7 +216,7 @@ static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp index 9c28c846f46..803392b9a19 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp @@ -88,17 +88,17 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -153,32 +153,32 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -186,7 +186,7 @@ static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index e9a3a12fce3..20885d4c7e5 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -94,14 +94,14 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_CLEAR_GROUP: @@ -113,7 +113,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -182,32 +182,32 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -215,7 +215,7 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index fd6bc2d94c1..3ac135224d9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -89,14 +89,14 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_SUBCONTROL_COLOR: @@ -150,7 +150,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -302,32 +302,32 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -335,7 +335,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp index 9feabb143aa..4e0cf84cd5d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp @@ -92,14 +92,14 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case BUTTON_CENTERED: @@ -115,7 +115,7 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, } // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -153,32 +153,32 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -186,7 +186,7 @@ static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp index 97fe8fd9887..25426af79df 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp @@ -112,17 +112,17 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *tabControl = TheEditor->getPropertyTarget(); @@ -344,32 +344,32 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -377,7 +377,7 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp index f8cfd235f14..9ba0f760575 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp @@ -88,17 +88,17 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, { // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- - case IDOK: + case IDOK: { GameWindow *window = TheEditor->getPropertyTarget(); @@ -178,32 +178,32 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, } - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } // -------------------------------------------------------------------- - case IDCANCEL: + case IDCANCEL: { - DestroyWindow( hWndDialog ); - break; + DestroyWindow( hWndDialog ); + break; } - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ - case WM_CLOSE: + case WM_CLOSE: { - DestroyWindow( hWndDialog ); - return 0; + DestroyWindow( hWndDialog ); + return 0; } @@ -211,7 +211,7 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, default: return 0; - } + } } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index 5616d54a06d..c04d1253bba 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -1288,26 +1288,26 @@ void EditWindow::drawUIFeedback( void ) window->winGetSize( &size.x, &size.y ); // figure out the destination of the window from this move - ICoord2D change; - change.x = (m_dragMoveDest.x - m_dragMoveOrigin.x); - change.y = (m_dragMoveDest.y - m_dragMoveOrigin.y); - - // [SKB: Jun 02 2003 @ 2:7pm] : - // Don't move the object unless we have moved the mouse, - // this is to avoid the irritating movement of a window when just - // clicking on a window. - if (change.x || change.y) - { - moveLoc.x = origin.x + change.x; - moveLoc.y = origin.y + change.y; + ICoord2D change; + change.x = (m_dragMoveDest.x - m_dragMoveOrigin.x); + change.y = (m_dragMoveDest.y - m_dragMoveOrigin.y); + + // [SKB: Jun 02 2003 @ 2:7pm] : + // Don't move the object unless we have moved the mouse, + // this is to avoid the irritating movement of a window when just + // clicking on a window. + if (change.x || change.y) + { + moveLoc.x = origin.x + change.x; + moveLoc.y = origin.y + change.y; // snap move location to grid if on - if( (TheEditor->getMode() == MODE_DRAG_MOVE) && TheEditor->isGridSnapOn() ) + if( (TheEditor->getMode() == MODE_DRAG_MOVE) && TheEditor->isGridSnapOn() ) TheEditor->gridSnapLocation( &moveLoc, &moveLoc ); // keep location legal - TheEditor->computeSafeLocation( window, moveLoc.x, moveLoc.y, + TheEditor->computeSafeLocation( window, moveLoc.x, moveLoc.y, &safeLoc.x, &safeLoc.y ); // adjust location by parent location if present diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 9868b51ddba..beeaf26e8d6 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -120,35 +120,35 @@ GUIEdit *TheEditor = nullptr; char *GUIEdit::saveAsDialog( void ) { static char filename[ _MAX_PATH ]; - OPENFILENAME ofn; - Bool returnCode; - char filter[] = "Window Files (*.wnd)\0*.wnd\0" \ + OPENFILENAME ofn; + Bool returnCode; + char filter[] = "Window Files (*.wnd)\0*.wnd\0" \ "All Files (*.*)\0*.*\0\0" ; - ofn.lStructSize = sizeof( OPENFILENAME ); - ofn.hwndOwner = m_appHWnd; - ofn.hInstance = nullptr; - ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = nullptr; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; - ofn.lpstrFile = filename; - ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = nullptr; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = nullptr; - ofn.lpstrTitle = nullptr; - ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = "wnd"; - ofn.lCustData = 0L ; - ofn.lpfnHook = nullptr ; - ofn.lpTemplateName = nullptr ; - - returnCode = GetSaveFileName( &ofn ); - - if( returnCode ) + ofn.lStructSize = sizeof( OPENFILENAME ); + ofn.hwndOwner = m_appHWnd; + ofn.hInstance = nullptr; + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = nullptr; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = filename; + ofn.nMaxFile = _MAX_PATH; + ofn.lpstrFileTitle = nullptr; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "wnd"; + ofn.lCustData = 0L ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; + + returnCode = GetSaveFileName( &ofn ); + + if( returnCode ) return filename; else return nullptr; @@ -162,35 +162,35 @@ char *GUIEdit::saveAsDialog( void ) char *GUIEdit::openDialog( void ) { static char filename[ _MAX_PATH ]; - OPENFILENAME ofn; - Bool returnCode; - char filter[] = "Window Files (*.wnd)\0*.wnd\0" \ + OPENFILENAME ofn; + Bool returnCode; + char filter[] = "Window Files (*.wnd)\0*.wnd\0" \ "All Files (*.*)\0*.*\0\0" ; - ofn.lStructSize = sizeof( OPENFILENAME ); - ofn.hwndOwner = m_appHWnd; - ofn.hInstance = nullptr; - ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = nullptr; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; - ofn.lpstrFile = filename; - ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = nullptr; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = nullptr; - ofn.lpstrTitle = nullptr; - ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = "wnd"; - ofn.lCustData = 0L ; - ofn.lpfnHook = nullptr ; - ofn.lpTemplateName = nullptr ; - - returnCode = GetOpenFileName( &ofn ); - - if( returnCode ) + ofn.lStructSize = sizeof( OPENFILENAME ); + ofn.hwndOwner = m_appHWnd; + ofn.hInstance = nullptr; + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = nullptr; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = filename; + ofn.nMaxFile = _MAX_PATH; + ofn.lpstrFileTitle = nullptr; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "wnd"; + ofn.lCustData = 0L ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; + + returnCode = GetOpenFileName( &ofn ); + + if( returnCode ) return filename; else return nullptr; @@ -248,7 +248,7 @@ void GUIEdit::setUnsaved( Bool unsaved ) //============================================================================= void GUIEdit::setSaveFile( const char *fullPathAndFilename ) { - const char *ptr; + const char *ptr; // copy over the full path and filename strlcpy(m_savePathAndFilename, fullPathAndFilename, ARRAY_SIZE(m_savePathAndFilename)); @@ -3338,7 +3338,7 @@ void GUIEdit::createStatusBar( void ) { RECT rect; Int width; - Int sizes[ STATUS_NUM_PARTS ]; + Int sizes[ STATUS_NUM_PARTS ]; // create the bar m_statusBarHWnd = CreateStatusWindow( WS_CHILD | @@ -3365,7 +3365,7 @@ void GUIEdit::createStatusBar( void ) } sizes[ STATUS_NUM_PARTS - 1 ] = -1; // right edge - SendMessage( m_statusBarHWnd, SB_SETPARTS, STATUS_NUM_PARTS, (LPARAM)sizes ); + SendMessage( m_statusBarHWnd, SB_SETPARTS, STATUS_NUM_PARTS, (LPARAM)sizes ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index 2f0622c1f6b..873d44eb3a3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -286,7 +286,7 @@ Int GUIEditWindowManager::winDestroy( GameWindow *window ) //------------------------------------------------------------------------------------------------- GameWindow *GUIEditWindowManager::winCreate( GameWindow *parent, UnsignedInt status, - Int x, Int y, + Int x, Int y, Int width, Int height, GameWinSystemFunc system, WinInstanceData *instData ) diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 4dad1818a42..5e582a7971a 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -88,25 +88,25 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, switch( message ) { - // ------------------------------------------------------------------------ - case WM_MOVE: - { + // ------------------------------------------------------------------------ + case WM_MOVE: + { // Int x = LOWORD( lParam ); // Int y = HIWORD( lParam ); - // record our position - RECT rect; - POINT p; - GetWindowRect( hWndDialog, &rect ); - p.x = rect.left; - p.y = rect.top; - ScreenToClient( TheEditor->getWindowHandle(), &p ); - dialogPos.x = p.x; - dialogPos.y = p.y; + // record our position + RECT rect; + POINT p; + GetWindowRect( hWndDialog, &rect ); + p.x = rect.left; + p.y = rect.top; + ScreenToClient( TheEditor->getWindowHandle(), &p ); + dialogPos.x = p.x; + dialogPos.y = p.y; - return 0; + return 0; - } + } // ------------------------------------------------------------------------ case WM_SIZE: @@ -472,14 +472,14 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); Int controlID = LOWORD( wParam ); // HWND hWndControl = (HWND)lParam; - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case MENU_HIERARCHY_MOVE_HERE: @@ -578,24 +578,24 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, } // -------------------------------------------------------------------- - case IDOK: - break; + case IDOK: + break; // -------------------------------------------------------------------- - case IDCANCEL: - break; + case IDCANCEL: + break; - } + } - return 0; + return 0; - } + } // ------------------------------------------------------------------------ default: return 0; - } + } } @@ -821,7 +821,7 @@ void HierarchyView::reset( void ) SendMessage( m_tree, TVM_EXPAND, TVE_COLLAPSERESET, (LPARAM)parentItem ); #if USE_FAST_FIND_ITEM - m_treeHash.clear(); + m_treeHash.clear(); #endif } @@ -962,9 +962,9 @@ void HierarchyView::removeWindow( GameWindow *window ) TreeView_DeleteItem( m_tree, item ); #if USE_FAST_FIND_ITEM - TreeHash::iterator find = m_treeHash.find(window); - if (find != m_treeHash.end()) - m_treeHash.erase(find); + TreeHash::iterator find = m_treeHash.find(window); + if (find != m_treeHash.end()) + m_treeHash.erase(find); #endif } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index eb20865d720..26cc8b3479c 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -200,35 +200,35 @@ static void saveData( HWND hWndDialog ) char *saveAsDialog( void ) { static char filename[ _MAX_PATH ]; - OPENFILENAME ofn; - Bool returnCode; - char filter[] = "Layout Scheme Files (*.ls)\0*.ls\0" \ + OPENFILENAME ofn; + Bool returnCode; + char filter[] = "Layout Scheme Files (*.ls)\0*.ls\0" \ "All Files (*.*)\0*.*\0\0" ; - ofn.lStructSize = sizeof( OPENFILENAME ); - ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = nullptr; - ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = nullptr; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; - ofn.lpstrFile = filename; - ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = nullptr; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = nullptr; - ofn.lpstrTitle = nullptr; - ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = "ls"; - ofn.lCustData = 0L ; - ofn.lpfnHook = nullptr ; - ofn.lpTemplateName = nullptr ; - - returnCode = GetSaveFileName( &ofn ); - - if( returnCode ) + ofn.lStructSize = sizeof( OPENFILENAME ); + ofn.hwndOwner = TheEditor->getWindowHandle(); + ofn.hInstance = nullptr; + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = nullptr; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = filename; + ofn.nMaxFile = _MAX_PATH; + ofn.lpstrFileTitle = nullptr; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "ls"; + ofn.lCustData = 0L ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; + + returnCode = GetSaveFileName( &ofn ); + + if( returnCode ) return filename; else return nullptr; @@ -242,35 +242,35 @@ char *saveAsDialog( void ) char *openDialog( void ) { static char filename[ _MAX_PATH ]; - OPENFILENAME ofn; - Bool returnCode; - char filter[] = "Layout Scheme Files (*.ls)\0*.ls\0" \ + OPENFILENAME ofn; + Bool returnCode; + char filter[] = "Layout Scheme Files (*.ls)\0*.ls\0" \ "All Files (*.*)\0*.*\0\0" ; - ofn.lStructSize = sizeof( OPENFILENAME ); - ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = nullptr; - ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = nullptr; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; - ofn.lpstrFile = filename; - ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = nullptr; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = nullptr; - ofn.lpstrTitle = nullptr; - ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = "ls"; - ofn.lCustData = 0L ; - ofn.lpfnHook = nullptr ; - ofn.lpTemplateName = nullptr ; - - returnCode = GetOpenFileName( &ofn ); - - if( returnCode ) + ofn.lStructSize = sizeof( OPENFILENAME ); + ofn.hwndOwner = TheEditor->getWindowHandle(); + ofn.hInstance = nullptr; + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = nullptr; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = filename; + ofn.nMaxFile = _MAX_PATH; + ofn.lpstrFileTitle = nullptr; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "ls"; + ofn.lCustData = 0L ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; + + returnCode = GetOpenFileName( &ofn ); + + if( returnCode ) return filename; else return nullptr; @@ -309,8 +309,8 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { // Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID // HWND hWndControl = (HWND)lParam; // control window handle diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index 72feb50dc80..5dfe67c0a09 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -877,10 +877,10 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) if( tooltipEdit ) loadTooltipTextLabel( tooltipEdit, window ); - // load text edit control if present + // load text edit control if present HWND tooltipDelay = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY ); if( tooltipDelay ) - SetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, instData->m_tooltipDelay, TRUE ); + SetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, instData->m_tooltipDelay, TRUE ); @@ -1144,10 +1144,10 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) if( editTooltipText ) saveTooltipTextLabel( editTooltipText, window ); - // save delay text label data if present + // save delay text label data if present HWND editTooltipDelayText = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY ); if( editTooltipDelayText ) - instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, nullptr, TRUE ); + instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, nullptr, TRUE ); HWND headerCombo = GetDlgItem( dialog, COMBO_HEADER ); if( headerCombo ) @@ -1176,7 +1176,7 @@ void LoadImageListComboBox( HWND comboBox ) SendMessage( comboBox, CB_RESETCONTENT, 0, 0 ); // load the combo box with string names from the GUI image collection - for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=nullptr;index++) + for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=nullptr;index++) { SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() ); @@ -1496,8 +1496,8 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, // ------------------------------------------------------------------------ case WM_DRAWITEM: { - UINT controlID = (UINT)wParam; // control identifier - LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing + UINT controlID = (UINT)wParam; // control identifier + LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing Color color = GAME_COLOR_UNDEFINED; // ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog ); @@ -1546,19 +1546,19 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, // Get the area we have to draw in GetClientRect( hWndControl, &rect ); - // create a new brush and select it into DC - hBrushNew = CreateSolidBrush( RGB ( r, g, b ) ); - hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); + // create a new brush and select it into DC + hBrushNew = CreateSolidBrush( RGB ( r, g, b ) ); + hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew ); - // draw the rectangle - Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); + // draw the rectangle + Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom ); - // put the old brush back and delete the new one - SelectObject( drawItem->hDC, hBrushOld ); - DeleteObject( hBrushNew ); + // put the old brush back and delete the new one + SelectObject( drawItem->hDC, hBrushOld ); + DeleteObject( hBrushNew ); - // validate this new area - ValidateRect( hWndControl, nullptr ); + // validate this new area + ValidateRect( hWndControl, nullptr ); // we have taken care of it *returnCode = TRUE; @@ -1573,14 +1573,14 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, } // ------------------------------------------------------------------------ - case WM_COMMAND: - { + case WM_COMMAND: + { Int notifyCode = HIWORD( wParam ); // notification code Int controlID = LOWORD( wParam ); // control ID HWND hWndControl = (HWND)lParam; // control window handle - switch( controlID ) - { + switch( controlID ) + { // -------------------------------------------------------------------- case COMBO_STATE: @@ -1704,14 +1704,14 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, } - } + } - *returnCode = 0; + *returnCode = 0; break; - } + } - } + } return used; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 9976e7ea723..8f93e3754b8 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -1013,7 +1013,7 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) saveFont( window, fp, dataIndent ); saveHeaderTemplate( window, fp, dataIndent ); saveTooltipText( window, fp, dataIndent ); - saveTooltipDelay( window, fp, dataIndent ); + saveTooltipDelay( window, fp, dataIndent ); saveText( window, fp, dataIndent ); saveTextColor( window, fp, dataIndent ); saveDrawData( "ENABLEDDRAWDATA", window, fp, dataIndent ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp index 493d5aecc4e..1ff537c21ba 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -785,7 +785,7 @@ LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message, } break; } - return FALSE; + return FALSE; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/AutoEdgeOutTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/AutoEdgeOutTool.h index c4a76c63e17..7368beb8009 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/AutoEdgeOutTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/AutoEdgeOutTool.h @@ -33,10 +33,10 @@ class AutoEdgeOutTool : public Tool { public: AutoEdgeOutTool(void); - ~AutoEdgeOutTool(void); + virtual ~AutoEdgeOutTool(void) override; public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h index 3616de46116..bbb9a65c9ea 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h @@ -41,7 +41,7 @@ class BaseBuildProps : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(BaseBuildProps) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -49,8 +49,8 @@ class BaseBuildProps : public CDialog // Generated message map functions //{{AFX_MSG(BaseBuildProps) - virtual BOOL OnInitDialog(); - virtual void OnOK(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendEdgeTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendEdgeTool.h index d3a62b21218..8088cbbc872 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendEdgeTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendEdgeTool.h @@ -36,11 +36,11 @@ class BlendEdgeTool : public Tool public: BlendEdgeTool(void); - ~BlendEdgeTool(void); + virtual ~BlendEdgeTool(void) override; public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h index 0bcf63f0589..ce0f0a1b919 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h @@ -45,10 +45,10 @@ class BlendMaterial : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(BlendMaterial) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -56,7 +56,7 @@ class BlendMaterial : public COptionsPanel enum {MIN_TILE_SIZE=2, MAX_TILE_SIZE = 100}; // Generated message map functions //{{AFX_MSG(BlendMaterial) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BorderTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BorderTool.h index 60721052bf9..bdcc88d52ab 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BorderTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BorderTool.h @@ -32,17 +32,17 @@ class BorderTool : public Tool public: BorderTool(); - ~BorderTool(); + virtual ~BorderTool() override; Int getToolID(void) {return m_toolID;} - virtual void setCursor(void); + virtual void setCursor(void) override; - virtual void activate(); - virtual void deactivate(); + virtual void activate() override; + virtual void deactivate() override; - virtual Bool followsTerrain(void) { return false; } + virtual Bool followsTerrain(void) override { return false; } - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BrushTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BrushTool.h index 7c767c82bba..d699978f97a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BrushTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BrushTool.h @@ -42,7 +42,7 @@ class BrushTool : public Tool public: BrushTool(void); - ~BrushTool(void); + virtual ~BrushTool(void) override; public: static Int getWidth(void) {return m_brushWidth;}; ///loadSides();}; static void setSelectedBuildList(BuildListInfo *pInfo); - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BuildListTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BuildListTool.h index f764a82e14d..f36b70f4735 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BuildListTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BuildListTool.h @@ -56,7 +56,7 @@ class BuildListTool : public Tool public: BuildListTool(void); - ~BuildListTool(void); + virtual ~BuildListTool(void) override; private: void createWindow(void); @@ -68,10 +68,10 @@ class BuildListTool : public Tool public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void setCursor(void); - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become not the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void setCursor(void) override; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become not the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CButtonShowColor.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CButtonShowColor.h index 3685c569525..15afd58a457 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CButtonShowColor.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CButtonShowColor.h @@ -27,7 +27,7 @@ class CButtonShowColor : public CButton const RGBColor& getColor(void) const { return m_color; } void setColor(Int color) { m_color.setFromInt(color); } void setColor(const RGBColor& color) { m_color = color; } - ~CButtonShowColor(); + virtual ~CButtonShowColor() override; static COLORREF RGBtoBGR(Int color); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h index 4a119cb0800..b05d5383cbf 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h @@ -33,8 +33,8 @@ class CFixTeamOwnerDialog : public CDialog Bool pickedValidTeam() { return m_pickedValidTeam; } protected: - virtual BOOL OnInitDialog(); - afx_msg void OnOK(); + virtual BOOL OnInitDialog() override; + virtual afx_msg void OnOK() override; DECLARE_MESSAGE_MAP() protected: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h index 697292ee83c..5e376f7a342 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h @@ -42,7 +42,7 @@ class Undoable : public RefCountClass public: Undoable(void); - ~Undoable(void); + virtual ~Undoable(void) override; public: virtual void Do(void)=0; ///< pure virtual. @@ -77,10 +77,10 @@ class WBDocUndoable : public Undoable WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset = nullptr); // destructor. - ~WBDocUndoable(void); - virtual void Do(void); - virtual void Undo(void); - virtual void Redo(void); + virtual ~WBDocUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; + virtual void Redo(void) override; }; @@ -99,9 +99,9 @@ class AddObjectUndoable : public Undoable AddObjectUndoable(CWorldBuilderDoc *pDoc, MapObject *pObjectToAdd); // destructor. - ~AddObjectUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~AddObjectUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; @@ -146,11 +146,11 @@ class ModifyObjectUndoable : public Undoable public: ModifyObjectUndoable(CWorldBuilderDoc *pDoc); // destructor. - ~ModifyObjectUndoable(void); + virtual ~ModifyObjectUndoable(void) override; - virtual void Do(void); - virtual void Undo(void); - virtual void Redo(void); + virtual void Do(void) override; + virtual void Undo(void) override; + virtual void Redo(void) override; void SetOffset(Real x, Real y); void SetZOffset(Real z); @@ -188,11 +188,11 @@ class ModifyFlagsUndoable : public Undoable public: ModifyFlagsUndoable(CWorldBuilderDoc *pDoc, Int flagMask, Int flagValue); // destructor. - ~ModifyFlagsUndoable(void); + virtual ~ModifyFlagsUndoable(void) override; - virtual void Do(void); - virtual void Undo(void); - virtual void Redo(void); + virtual void Do(void) override; + virtual void Undo(void) override; + virtual void Redo(void) override; }; @@ -205,10 +205,10 @@ class SidesListUndoable : public Undoable public: SidesListUndoable(const SidesList& newSL, CWorldBuilderDoc *pDoc); - ~SidesListUndoable(void); + virtual ~SidesListUndoable(void) override; - virtual void Do(void); - virtual void Undo(void); + virtual void Do(void) override; + virtual void Undo(void) override; }; @@ -231,10 +231,10 @@ class DictItemUndoable : public Undoable // if you want to substitute the entire contents of the new dict, pass NAMEKEY_INVALID. DictItemUndoable(Dict **d, Dict data, NameKeyType key, Int dictsToModify = 1, CWorldBuilderDoc *pDoc = nullptr, Bool inval = false); // destructor. - ~DictItemUndoable(void); + virtual ~DictItemUndoable(void) override; - virtual void Do(void); - virtual void Undo(void); + virtual void Do(void) override; + virtual void Undo(void) override; }; @@ -267,9 +267,9 @@ class DeleteObjectUndoable : public Undoable DeleteObjectUndoable(CWorldBuilderDoc *pDoc); // destructor. - ~DeleteObjectUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~DeleteObjectUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// AddPolygonUndoable @@ -282,9 +282,9 @@ class AddPolygonUndoable : public Undoable public: AddPolygonUndoable( PolygonTrigger *pTrig); // destructor. - ~AddPolygonUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~AddPolygonUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// AddPolygonPointUndoable @@ -297,9 +297,9 @@ class AddPolygonPointUndoable : public Undoable public: AddPolygonPointUndoable(PolygonTrigger *pTrig, ICoord3D pt); // destructor. - ~AddPolygonPointUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~AddPolygonPointUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// ModifyPolygonPointUndoable @@ -314,9 +314,9 @@ class ModifyPolygonPointUndoable : public Undoable public: ModifyPolygonPointUndoable(PolygonTrigger *pTrig, Int ndx); // destructor. - ~ModifyPolygonPointUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~ModifyPolygonPointUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// MovePolygonUndoable @@ -330,9 +330,9 @@ class MovePolygonUndoable : public Undoable public: MovePolygonUndoable(PolygonTrigger *pTrig); // destructor. - ~MovePolygonUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~MovePolygonUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; void SetOffset(const ICoord3D &offset); PolygonTrigger *getTrigger(void) {return m_trigger;} @@ -349,9 +349,9 @@ class InsertPolygonPointUndoable : public Undoable public: InsertPolygonPointUndoable(PolygonTrigger *pTrig, ICoord3D pt, Int ndx); // destructor. - ~InsertPolygonPointUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~InsertPolygonPointUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// DeletePolygonPointUndoable @@ -365,9 +365,9 @@ class DeletePolygonPointUndoable : public Undoable public: DeletePolygonPointUndoable(PolygonTrigger *pTrig, Int ndx); // destructor. - ~DeletePolygonPointUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~DeletePolygonPointUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// DeletePolygonUndoable @@ -380,9 +380,9 @@ class DeletePolygonUndoable : public Undoable public: DeletePolygonUndoable(PolygonTrigger *pTrig); // destructor. - ~DeletePolygonUndoable(void); - virtual void Do(void); - virtual void Undo(void); + virtual ~DeletePolygonUndoable(void) override; + virtual void Do(void) override; + virtual void Undo(void) override; }; /// MultipleUndoable @@ -393,18 +393,18 @@ class DeletePolygonUndoable : public Undoable class MultipleUndoable : public Undoable { protected: - Undoable * m_undoableList; //< The head of the list of undoables, in the order they should be done. Reverse order for undoes + Undoable * m_undoableList; //< The head of the list of undoables, in the order they should be done. Reverse order for undoes public: MultipleUndoable(); - // destructor. - ~MultipleUndoable(void); + // destructor. + virtual ~MultipleUndoable(void) override; /** Add other undoables in the order you would want them UNdone; e.g. in the reverse order you want them done * The MultipleUndoable object will then own the pointers. */ - void addUndoable( Undoable * undoable ); + void addUndoable( Undoable * undoable ); - virtual void Do(void); - virtual void Undo(void); - virtual void Redo(void); + virtual void Do(void) override; + virtual void Undo(void) override; + virtual void Redo(void) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h index f85a49b6497..655c197b44c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h @@ -44,7 +44,7 @@ class CameraOptions : public CDialog, public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CameraOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -56,7 +56,7 @@ class CameraOptions : public CDialog, public PopupSliderOwner afx_msg void OnDropWaypointButton(); afx_msg void OnCenterOnSelectedButton(); afx_msg void OnMove(int x, int y); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangePitchEdit(); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); //}}AFX_MSG @@ -75,9 +75,9 @@ class CameraOptions : public CDialog, public PopupSliderOwner public: // popup slider interface. - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; public: void update( void ); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h index bf3fd543efe..34ececd084b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h @@ -42,8 +42,8 @@ class CellWidth : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CellWidth) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override; //}}AFX_VIRTUAL // Implementation @@ -54,7 +54,7 @@ class CellWidth : public CDialog // Generated message map functions //{{AFX_MSG(CellWidth) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h index 707beb4ca8b..ab501fb64d2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h @@ -48,7 +48,7 @@ class ContourOptions : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ContourOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -56,7 +56,7 @@ class ContourOptions : public CDialog // Generated message map functions //{{AFX_MSG(ContourOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnShowContours(); //}}AFX_MSG diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h b/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h index 77ea5426b16..650f215e24c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h @@ -48,26 +48,26 @@ class DrawObject : public RenderObjClass DrawObject(void); DrawObject(const DrawObject & src); DrawObject & operator = (const DrawObject &); - ~DrawObject(void); + virtual ~DrawObject(void) override; ///////////////////////////////////////////////////////////////////////////// // Render Object Interface ///////////////////////////////////////////////////////////////////////////// - virtual RenderObjClass * Clone(void) const; - virtual int Class_ID(void) const; - virtual void Render(RenderInfoClass & rinfo); + virtual RenderObjClass * Clone(void) const override; + virtual int Class_ID(void) const override; + virtual void Render(RenderInfoClass & rinfo) override; // virtual void Special_Render(SpecialRenderInfoClass & rinfo); // virtual void Set_Transform(const Matrix3D &m); // virtual void Set_Position(const Vector3 &v); //TODO: MW: do these later - only needed for collision detection - virtual Bool Cast_Ray(RayCollisionTestClass & raytest); + virtual Bool Cast_Ray(RayCollisionTestClass & raytest) override; // virtual Bool Cast_AABox(AABoxCollisionTestClass & boxtest); // virtual Bool Cast_OBBox(OBBoxCollisionTestClass & boxtest); // virtual Bool Intersect_AABox(AABoxIntersectionTestClass & boxtest); // virtual Bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest); - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; + virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; + virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const override; // virtual int Get_Num_Polys(void) const; @@ -81,7 +81,7 @@ class DrawObject : public RenderObjClass Int freeMapResources(void); int initData(void); - void setDrawObjects(Bool val, Bool waypoints, Bool poly, Bool bounding, Bool sight, Bool weapon, Bool sound, Bool testart, Bool letterbox) { m_drawObjects = val; m_drawWaypoints=waypoints; m_drawPolygonAreas = poly; m_drawBoundingBoxes = bounding; m_drawSightRanges = sight; m_drawWeaponRanges = weapon; m_drawSoundRanges = sound; m_drawTestArtHighlight = testart, m_drawLetterbox = letterbox;} + void setDrawObjects(Bool val, Bool waypoints, Bool poly, Bool bounding, Bool sight, Bool weapon, Bool sound, Bool testart, Bool letterbox) { m_drawObjects = val; m_drawWaypoints=waypoints; m_drawPolygonAreas = poly; m_drawBoundingBoxes = bounding; m_drawSightRanges = sight; m_drawWeaponRanges = weapon; m_drawSoundRanges = sound; m_drawTestArtHighlight = testart, m_drawLetterbox = letterbox;} static void setDoBrushFeedback(Bool val) { m_toolWantsFeedback = val; m_meshFeedback=false;} static void setDoMeshFeedback(Bool val) { m_meshFeedback = val; } static void setDoRampFeedback(Bool val) { m_rampFeedback = val; } @@ -129,7 +129,7 @@ class DrawObject : public RenderObjClass Bool m_drawBoundingBoxes; Bool m_drawSightRanges; Bool m_drawWeaponRanges; - Bool m_drawSoundRanges; + Bool m_drawSoundRanges; Bool m_drawTestArtHighlight; Bool m_drawLetterbox; @@ -167,7 +167,7 @@ class DrawObject : public RenderObjClass static Real m_rampWidth; protected: - void addCircleToLineRenderer( const Coord3D & center, Real radius, Real width, unsigned long color, CameraClass* camera ); + void addCircleToLineRenderer( const Coord3D & center, Real radius, Real width, unsigned long color, CameraClass* camera ); Int updateVB(DX8VertexBufferClass *vertexBufferTile, Int color, Bool doArrow, Bool doDiamond); void updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOpen); void updateFeedbackVB(void); @@ -181,7 +181,7 @@ class DrawObject : public RenderObjClass void updateVBWithSightRange(MapObject *pMapObj, CameraClass* camera); void updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera); void updateVBWithTestArtHighlight(MapObject *pMapObj, CameraClass* camera); - void updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera); + void updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera); bool worldToScreen(const Coord3D *w, ICoord2D *s, CameraClass* camera); }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h index 7f9ca36525a..2e64f151d05 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h @@ -45,8 +45,8 @@ class EditAction : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditAction) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -68,7 +68,7 @@ class EditAction : public CDialog // Generated message map functions //{{AFX_MSG(EditAction) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnSelchangeScriptActionType(); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h index d15363517cf..90da61f7733 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h @@ -28,7 +28,7 @@ class SidesList; class CMyTreeCtrl : public CTreeCtrl { public: - virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam ); + virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam ) override; }; ///////////////////////////////////////////////////////////////////////////// @@ -51,8 +51,8 @@ class EditCondition : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditCondition) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -74,7 +74,7 @@ class EditCondition : public CDialog // Generated message map functions //{{AFX_MSG(EditCondition) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnSelchangeConditionType(); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h index c4050f7e64e..9959dd1a379 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h @@ -43,7 +43,7 @@ friend class EditParameter; // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditCoordParameter) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -59,9 +59,9 @@ friend class EditParameter; // Generated message map functions //{{AFX_MSG(EditCoordParameter) - virtual BOOL OnInitDialog(); - virtual void OnOK(); - virtual void OnCancel(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + virtual void OnCancel() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h index f0297ed6726..c4cdeb5bd62 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h @@ -42,7 +42,7 @@ class EditGroup : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditGroup) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -53,8 +53,8 @@ class EditGroup : public CDialog // Generated message map functions //{{AFX_MSG(EditGroup) - virtual void OnOK(); - virtual BOOL OnInitDialog(); + virtual void OnOK() override; + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h index 0544cf79dec..da951f252e4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h @@ -43,8 +43,8 @@ friend class EditParameter; // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditObjectParameter) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -63,9 +63,9 @@ friend class EditParameter; // Generated message map functions //{{AFX_MSG(EditObjectParameter) - virtual BOOL OnInitDialog(); - virtual void OnOK(); - virtual void OnCancel(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + virtual void OnCancel() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h index d5143cc538a..3220d9a1862 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h @@ -44,7 +44,7 @@ class EditParameter : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(EditParameter) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -119,9 +119,9 @@ class EditParameter : public CDialog //{{AFX_MSG(EditParameter) afx_msg void OnChangeEdit(); afx_msg void OnEditchangeCombo(); - virtual BOOL OnInitDialog(); - virtual void OnOK(); - virtual void OnCancel(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + virtual void OnCancel() override; afx_msg void OnPreviewSound(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h index ae3d28a3fd5..5fc1df77669 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h @@ -41,7 +41,7 @@ class ExportScriptsOptions : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ExportScriptsOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -63,8 +63,8 @@ class ExportScriptsOptions : public CDialog // Generated message map functions //{{AFX_MSG(ExportScriptsOptions) - virtual void OnOK(); - virtual BOOL OnInitDialog(); + virtual void OnOK() override; + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EyedropperTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EyedropperTool.h index 90b25177a47..10911a65ba0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EyedropperTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EyedropperTool.h @@ -33,10 +33,10 @@ class EyedropperTool : public Tool { public: EyedropperTool(void); - ~EyedropperTool(void); + virtual ~EyedropperTool(void) override; public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h index 196a176daba..f50ccc3a3fe 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h @@ -50,9 +50,9 @@ class FeatherOptions : public COptionsPanel , public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(FeatherOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_VIRTUAL // Implementation @@ -60,7 +60,7 @@ class FeatherOptions : public COptionsPanel , public PopupSliderOwner // Generated message map functions //{{AFX_MSG(FeatherOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeSizeEdit(); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -83,9 +83,9 @@ class FeatherOptions : public COptionsPanel , public PopupSliderOwner public: - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherTool.h index c0617139f97..fccee3328c3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherTool.h @@ -41,15 +41,15 @@ class FeatherTool : public Tool static Int m_radius; public: FeatherTool(void); - ~FeatherTool(void); + virtual ~FeatherTool(void) override; static void setFeather(Int feather); static void setRate(Int rate); static void setRadius(Int Radius); public: - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;}; - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual WorldHeightMapEdit *getHeightMap(void) override {return m_htMapEditCopy;}; + virtual void activate() override; ///< Become the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h index d15832745c5..557aa1dce90 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h @@ -35,7 +35,7 @@ class FenceOptions : public COptionsPanel public: FenceOptions(CWnd* pParent = nullptr); ///< standard constructor - ~FenceOptions(void); ///< standard destructor + virtual ~FenceOptions(void) override; ///< standard destructor enum { NAME_MAX_LEN = 64 }; // Dialog Data //{{AFX_DATA(FenceOptions) @@ -48,10 +48,10 @@ class FenceOptions : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(FenceOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -59,7 +59,7 @@ class FenceOptions : public COptionsPanel // Generated message map functions //{{AFX_MSG(FenceOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeFenceSpacingEdit(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceTool.h index 2ea16a9e358..2a1fabe2eb3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceTool.h @@ -42,15 +42,15 @@ class FenceTool : public Tool public: FenceTool(void); - ~FenceTool(void); + virtual ~FenceTool(void) override; protected: void updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView, CWorldBuilderDoc *pDoc, Bool checkPlayers); public: - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become not the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become not the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FloodFillTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FloodFillTool.h index e33be6a5766..3fcca8d8f9d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FloodFillTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FloodFillTool.h @@ -32,7 +32,7 @@ class FloodFillTool : public Tool { public: FloodFillTool(void); - ~FloodFillTool(void); + virtual ~FloodFillTool(void) override; protected: Int m_textureClassToDraw; ///< The texture to fill with. Foreground for mousedDown, background for mouseDownRt. @@ -40,9 +40,9 @@ class FloodFillTool : public Tool static Bool m_adjustCliffTextures; public: - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. - virtual void setCursor(void); + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. + virtual void setCursor(void) override; Bool getAdjustCliffs(void) {return m_adjustCliffTextures;} void setAdjustCliffs(Bool val) {m_adjustCliffTextures = val;} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h index 96e9297e56e..81a4a4b0f8c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h @@ -53,7 +53,7 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(GlobalLightOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -61,7 +61,7 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner // Generated message map functions //{{AFX_MSG(GlobalLightOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); afx_msg void OnMove(int x, int y); afx_msg void OnChangeFrontBackEdit(); @@ -73,8 +73,8 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner afx_msg void OnColorPress(); afx_msg void OnResetLights(); afx_msg void OnClose(); - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -127,9 +127,9 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner void stuffValuesIntoFields(Int lightIndex = 0); public: - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h index d574ccea489..c2d253ad71b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h @@ -46,10 +46,10 @@ class GroveOptions : public COptionsPanel public: GroveOptions(CWnd* pParent = nullptr); - ~GroveOptions(); + virtual ~GroveOptions() override; void makeMain(void); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; int getNumTrees(void); int getNumType(int type); AsciiString getTypeName(int type); @@ -69,7 +69,7 @@ class GroveOptions : public COptionsPanel afx_msg void _updateGroveMakeup(void); afx_msg void _updatePlacementAllowed(void); - virtual void OnOK(); + virtual void OnOK() override; virtual void OnClose(); DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveTool.h index cd69ab6ecaa..9bd6dc4107f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveTool.h @@ -46,15 +46,15 @@ class GroveTool : public Tool void _plantGroveInBox(CPoint tl, CPoint br, WbView* pView); void addObj(Coord3D *pos, AsciiString name); - void activate(); + virtual void activate() override; public: GroveTool(void); - ~GroveTool(void); + virtual ~GroveTool(void) override; public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/HandScrollTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/HandScrollTool.h index fa47bbfa1ce..f8d20e4fa01 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/HandScrollTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/HandScrollTool.h @@ -31,7 +31,7 @@ class HandScrollTool : public Tool { public: HandScrollTool(void); - ~HandScrollTool(void); + virtual ~HandScrollTool(void) override; protected: enum {HYSTERESIS = 3}; @@ -42,11 +42,11 @@ class HandScrollTool : public Tool public: /// Start scrolling. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; /// Scroll. - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; /// End scroll. - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. - virtual Bool followsTerrain(void) {return false;}; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. + virtual Bool followsTerrain(void) override {return false;}; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h index 1b86b2aee68..c0a70433005 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -25,7 +25,7 @@ class ImpassableOptions : public CDialog public: ImpassableOptions(CWnd* pParent = nullptr, Real defaultSlope = 45.0f); - virtual ~ImpassableOptions(); + virtual ~ImpassableOptions() override; Real GetSlopeToShow() const { return m_slopeToShow; } Real GetDefaultSlope() const { return m_defaultSlopeToShow; } void SetDefaultSlopeToShow(Real slopeToShow) { m_slopeToShow = slopeToShow; } @@ -38,7 +38,7 @@ class ImpassableOptions : public CDialog Bool ValidateSlope(); // Returns TRUE if it was valid, FALSE if it had to adjust it. protected: - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnAngleChange(); afx_msg void OnPreview(); DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h index 1cfa2c943e9..47e2781e7a8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h @@ -87,7 +87,7 @@ class LayersList : public CDialog public: enum { IDD = IDD_LAYERSLIST }; LayersList(UINT nIDTemplate = LayersList::IDD, CWnd *parentWnd = nullptr); - virtual ~LayersList(); + virtual ~LayersList() override; void resetLayers(); void addMapObjectToLayersList(IN MapObject *objToAdd, AsciiString layerToAddTo = AsciiString(TheDefaultLayerName.c_str())); @@ -162,9 +162,9 @@ class LayersList : public CDialog void updateTreeImages(); protected: - virtual void OnOK(); - virtual void OnCancel(); - virtual BOOL OnInitDialog(); + virtual void OnOK() override; + virtual void OnCancel() override; + virtual BOOL OnInitDialog() override; afx_msg void OnBeginEditLabel(NMHDR *pNotifyStruct, LRESULT* pResult); afx_msg void OnEndEditLabel(NMHDR *pNotifyStruct, LRESULT* pResult); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h index 2436707271c..e5d5220b483 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h @@ -44,9 +44,9 @@ class LightOptions : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(LightOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_VIRTUAL // Implementation @@ -54,7 +54,7 @@ class LightOptions : public COptionsPanel // Generated message map functions //{{AFX_MSG(LightOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeLightEdit(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MainFrm.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MainFrm.h index e8081da8c49..1dccfe90cb2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MainFrm.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MainFrm.h @@ -55,7 +55,7 @@ class ScriptDialog; class CMainFrame : public CFrameWnd { - DECLARE_DYNAMIC(CMainFrame) + DECLARE_DYNAMIC(CMainFrame) public: CMainFrame(); @@ -69,12 +69,12 @@ class CMainFrame : public CFrameWnd // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMainFrame) - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs) override; //}}AFX_VIRTUAL // Implementation public: - virtual ~CMainFrame(); + virtual ~CMainFrame() override; #ifdef RTS_DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h index 73b0ddad53e..d40335d3e49 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h @@ -41,7 +41,7 @@ class MapSettings : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(MapSettings) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -51,8 +51,8 @@ class MapSettings : public CDialog //{{AFX_MSG(MapSettings) afx_msg void OnChangeMapTimeofday(); afx_msg void OnChangeMapWeather(); - virtual BOOL OnInitDialog(); - virtual void OnOK(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; afx_msg void OnChangeMapTitle(); afx_msg void OnChangeMapCompression(); //}}AFX_MSG diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h index 623164d30e9..573317fd2ca 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h @@ -50,11 +50,11 @@ class MeshMoldOptions : public COptionsPanel , public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(MeshMoldOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnInitDialog() override; + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -103,9 +103,9 @@ class MeshMoldOptions : public COptionsPanel , public PopupSliderOwner static AsciiString getModelName(void) {if (m_staticThis) return m_staticThis->m_meshModelName; return "";}; public: //PopupSliderOwner methods. - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; //{{AFX_INSERT_LOCATION}} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldTool.h index 66ed3e1c988..479b8ddd190 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldTool.h @@ -42,7 +42,7 @@ class MeshMoldTool : public Tool public: MeshMoldTool(void); - ~MeshMoldTool(void); + virtual ~MeshMoldTool(void) override; protected: static void applyMesh(CWorldBuilderDoc *pDoc); ///< Apply the mesh to copy of terrain. @@ -50,13 +50,13 @@ class MeshMoldTool : public Tool static void apply(CWorldBuilderDoc *pDoc); ///< Apply the mesh to the terrain & execute undoable. public: //Tool methods. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;}; - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become the current tool. - virtual Bool followsTerrain(void) {return false;}; + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual WorldHeightMapEdit *getHeightMap(void) override {return m_htMapEditCopy;}; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become the current tool. + virtual Bool followsTerrain(void) override {return false;}; public: // Methods specific to MeshMoldTool. static void updateMeshLocation(Bool changePreview); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h index 19e2aed5cc5..8a6cda92ba1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h @@ -54,9 +54,9 @@ class MoundOptions : public COptionsPanel , public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(MoundOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_VIRTUAL // Implementation @@ -64,7 +64,7 @@ class MoundOptions : public COptionsPanel , public PopupSliderOwner // Generated message map functions //{{AFX_MSG(MoundOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeFeatherEdit(); afx_msg void OnChangeSizeEdit(); afx_msg void OnChangeHeightEdit(); @@ -89,9 +89,9 @@ class MoundOptions : public COptionsPanel , public PopupSliderOwner public: - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; //{{AFX_INSERT_LOCATION}} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundTool.h index 5d28cfbf99b..724af775589 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundTool.h @@ -42,7 +42,7 @@ class MoundTool : public Tool public: MoundTool(void); - ~MoundTool(void); + virtual ~MoundTool(void) override; public: static Int getMoundHeight(void) {return m_moundHeight;}; @@ -53,11 +53,11 @@ class MoundTool : public Tool static void setFeather(Int feather); public: - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;}; - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual WorldHeightMapEdit *getHeightMap(void) override {return m_htMapEditCopy;}; + virtual void activate() override; ///< Become the current tool. }; /************************************************************************* diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MyToolbar.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MyToolbar.h index ab80c805440..47dc4b1f709 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MyToolbar.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MyToolbar.h @@ -33,11 +33,11 @@ class CellSizeToolBar : public CDialogBar protected: afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam ); + virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam ) override; DECLARE_MESSAGE_MAP() public: - ~CellSizeToolBar(void); + virtual ~CellSizeToolBar(void) override; void SetupSlider(void); static void CellSizeChanged(Int cellSize); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h index 42fa791d437..8ecf703dee3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h @@ -57,9 +57,9 @@ class CNewHeightMap : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CNewHeightMap) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(); - virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override; + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam) override; //}}AFX_VIRTUAL // Implementation @@ -74,7 +74,7 @@ class CNewHeightMap : public CDialog // Generated message map functions //{{AFX_MSG(CNewHeightMap) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h index b3061ad29b4..85c6c205b3a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h @@ -35,7 +35,7 @@ class ObjectOptions : public COptionsPanel public: ObjectOptions(CWnd* pParent = nullptr); ///< standard constructor - ~ObjectOptions(void); ///< standard destructor + virtual ~ObjectOptions(void) override; ///< standard destructor enum { NAME_MAX_LEN = 64 }; // Dialog Data //{{AFX_DATA(ObjectOptions) @@ -48,10 +48,10 @@ class ObjectOptions : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ObjectOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -59,7 +59,7 @@ class ObjectOptions : public COptionsPanel // Generated message map functions //{{AFX_MSG(ObjectOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnEditchangeOwningteam(); afx_msg void OnCloseupOwningteam(); afx_msg void OnSelchangeOwningteam(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectPreview.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectPreview.h index 70b5262e5c1..9169b23dd48 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectPreview.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectPreview.h @@ -46,7 +46,7 @@ class ObjectPreview : public CWnd // Implementation public: - virtual ~ObjectPreview(); + virtual ~ObjectPreview() override; void SetThingTemplate(const ThingTemplate *tTempl); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectTool.h index 8e58449bbab..2deea4286b4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectTool.h @@ -37,16 +37,16 @@ class ObjectTool : public Tool public: ObjectTool(void); - ~ObjectTool(void); + virtual ~ObjectTool(void) override; public: static Real calcAngle(Coord3D downPt, Coord3D curPt, WbView* pView); public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become not the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become not the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h index 6b5452038bc..02e0c48704d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h @@ -48,7 +48,7 @@ class OpenMap : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(OpenMap) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -63,8 +63,8 @@ class OpenMap : public CDialog afx_msg void OnBrowse(); afx_msg void OnSystemMaps(); afx_msg void OnUserMaps(); - virtual void OnOK(); - virtual BOOL OnInitDialog(); + virtual void OnOK() override; + virtual BOOL OnInitDialog() override; afx_msg void OnDblclkOpenList(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h b/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h index 5b7847e1ace..648b9795dbe 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h @@ -45,7 +45,7 @@ class COptionsPanel : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(COptionsPanel) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h index adc8c759f85..78d3b49c0b1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h @@ -48,7 +48,7 @@ class PickUnitDialog : public CDialog public: PickUnitDialog(CWnd* pParent = nullptr); // standard constructor PickUnitDialog(UINT id, CWnd* pParent = nullptr); // standard constructor - ~PickUnitDialog(void); ///< standard destructor + virtual ~PickUnitDialog(void) override; ///< standard destructor // Dialog Data //{{AFX_DATA(PickUnitDialog) @@ -61,8 +61,8 @@ class PickUnitDialog : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(PickUnitDialog) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -70,7 +70,7 @@ class PickUnitDialog : public CDialog // Generated message map functions //{{AFX_MSG(PickUnitDialog) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnMove(int x, int y); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -95,7 +95,7 @@ class ReplaceUnitDialog : public PickUnitDialog // Generated message map functions //{{AFX_MSG(ReplaceUnitDialog) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/PointerTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/PointerTool.h index 4dd8dd1876f..d58bf5d6ef1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/PointerTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/PointerTool.h @@ -58,17 +58,17 @@ class PointerTool : public PolygonTool public: PointerTool(void); - ~PointerTool(void); + virtual ~PointerTool(void) override; public: /// Clear the selection on activate or deactivate. - virtual void activate(); - virtual void deactivate(); + virtual void activate() override; + virtual void deactivate() override; - virtual void setCursor(void); - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void setCursor(void) override; + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; public: static void clearSelection(void); ///< Clears the selected objects selected flags. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/PolygonTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/PolygonTool.h index 674709b8efd..2d3aac86174 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/PolygonTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/PolygonTool.h @@ -36,7 +36,7 @@ class PolygonTool : public Tool { public: PolygonTool(void); - ~PolygonTool(void); + virtual ~PolygonTool(void) override; protected: Coord3D m_poly_mouseDownPt; @@ -74,10 +74,10 @@ class PolygonTool : public Tool public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void setCursor(void); - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become not the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void setCursor(void) override; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become not the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h index 320ac87de1a..e9993d4c427 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h @@ -48,7 +48,7 @@ class RampOptions : public COptionsPanel public: enum { IDD = IDD_RAMP_OPTIONS }; RampOptions(CWnd* pParent = nullptr); - virtual ~RampOptions(); + virtual ~RampOptions() override; Bool shouldApplyTheRamp(); Real getRampWidth() { return m_rampWidth; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RampTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RampTool.h index 41f979d6458..41c55134342 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RampTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RampTool.h @@ -49,14 +49,14 @@ class RampTool : public Tool public: RampTool(); - virtual void activate(); - virtual void deactivate(); ///< Become not the current tool. + virtual void activate() override; + virtual void deactivate() override; ///< Become not the current tool. - virtual Bool followsTerrain(void); + virtual Bool followsTerrain(void) override; - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; protected: void drawFeedback(Coord3D* endPoint); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h index c1444bd9248..40e3c8d5f17 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h @@ -35,7 +35,7 @@ class RoadOptions : public COptionsPanel public: RoadOptions(CWnd* pParent = nullptr); ///< standard constructor - ~RoadOptions(void); ///< standard destructor + virtual ~RoadOptions(void) override; ///< standard destructor enum { NAME_MAX_LEN = 64 }; // Dialog Data //{{AFX_DATA(RoadOptions) @@ -48,10 +48,10 @@ class RoadOptions : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(RoadOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -59,7 +59,7 @@ class RoadOptions : public COptionsPanel // Generated message map functions //{{AFX_MSG(RoadOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnTightCurve(); afx_msg void OnAngled(); afx_msg void OnBroadCurve(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadTool.h index 1bae16e13dd..462bc89beac 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadTool.h @@ -43,15 +43,15 @@ class RoadTool : public Tool public: RoadTool(void); - ~RoadTool(void); + virtual ~RoadTool(void) override; public: static Bool snap(Coord3D *pLoc, Bool skipLast); public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h index dd8dde7abba..ce6e8a0ec27 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h @@ -44,9 +44,9 @@ class RulerOptions : public COptionsPanel // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(RulerOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_VIRTUAL // Implementation @@ -54,7 +54,7 @@ class RulerOptions : public COptionsPanel // Generated message map functions //{{AFX_MSG(RulerOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeWidthEdit(); afx_msg void OnChangeCheckRuler(); //}}AFX_MSG diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerTool.h index 4d0ff121ec0..0db6664f15f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerTool.h @@ -35,17 +35,17 @@ class RulerTool : public Tool public: RulerTool(void); - ~RulerTool(void); + virtual ~RulerTool(void) override; public: /// Clear the selection on activate or deactivate. - virtual void activate(); - virtual void deactivate(); + virtual void activate() override; + virtual void deactivate() override; - virtual void setCursor(void); - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual Bool followsTerrain(void) {return false;}; + virtual void setCursor(void) override; + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual Bool followsTerrain(void) override {return false;}; static void setLength(Real length); static Bool switchType(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h index 11c85a6e29d..09afb838d51 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h @@ -49,7 +49,7 @@ class SaveMap : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(SaveMap) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -61,13 +61,13 @@ class SaveMap : public CDialog // Generated message map functions //{{AFX_MSG(SaveMap) - virtual void OnOK(); - virtual void OnCancel(); + virtual void OnOK() override; + virtual void OnCancel() override; afx_msg void OnBrowse(); afx_msg void OnSystemMaps(); afx_msg void OnUserMaps(); afx_msg void OnSelchangeSaveList(); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h index 998af495aa4..b0c303e21e7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h @@ -47,9 +47,9 @@ class ScorchOptions : public COptionsPanel, public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ScorchOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; //!< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless. //}}AFX_VIRTUAL // Implementation @@ -57,7 +57,7 @@ class ScorchOptions : public COptionsPanel, public PopupSliderOwner // Generated message map functions //{{AFX_MSG(ScorchOptions) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnChangeScorchtype(); afx_msg void OnChangeSizeEdit(); //}}AFX_MSG @@ -83,9 +83,9 @@ class ScorchOptions : public COptionsPanel, public PopupSliderOwner static Scorches getScorchType(void) {return m_scorchtype;} static Real getScorchSize(void) {return m_scorchsize;} - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; //{{AFX_INSERT_LOCATION}} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchTool.h index a644cc23436..88fb189b2fe 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchTool.h @@ -32,7 +32,7 @@ class ScorchTool : public Tool { public: ScorchTool(void); - ~ScorchTool(void); + virtual ~ScorchTool(void) override; protected: Coord3D m_mouseDownPt; @@ -42,9 +42,9 @@ class ScorchTool : public Tool public: /// Perform tool on mouse down. - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void activate(); ///< Become the current tool. - virtual void deactivate(); ///< Become not the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void activate() override; ///< Become the current tool. + virtual void deactivate() override; ///< Become not the current tool. }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsFalse.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsFalse.h index 284c6412db5..874dcf3248c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsFalse.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsFalse.h @@ -33,7 +33,7 @@ class ScriptActionsFalse : public CPropertyPage // Construction public: ScriptActionsFalse(); - ~ScriptActionsFalse(); + virtual ~ScriptActionsFalse() override; // Dialog Data //{{AFX_DATA(ScriptActionsFalse) @@ -47,7 +47,7 @@ class ScriptActionsFalse : public CPropertyPage // ClassWizard generate virtual function overrides //{{AFX_VIRTUAL(ScriptActionsFalse) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -67,7 +67,7 @@ class ScriptActionsFalse : public CPropertyPage protected: // Generated message map functions //{{AFX_MSG(ScriptActionsFalse) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnEditAction(); afx_msg void OnSelchangeActionList(); afx_msg void OnDblclkActionList(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsTrue.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsTrue.h index f10b085569b..5c66fe2b433 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsTrue.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptActionsTrue.h @@ -33,7 +33,7 @@ class ScriptActionsTrue : public CPropertyPage // Construction public: ScriptActionsTrue(); - ~ScriptActionsTrue(); + virtual ~ScriptActionsTrue() override; // Dialog Data //{{AFX_DATA(ScriptActionsTrue) @@ -47,7 +47,7 @@ class ScriptActionsTrue : public CPropertyPage // ClassWizard generate virtual function overrides //{{AFX_VIRTUAL(ScriptActionsTrue) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -67,7 +67,7 @@ class ScriptActionsTrue : public CPropertyPage protected: // Generated message map functions //{{AFX_MSG(ScriptActionsTrue) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnEditAction(); afx_msg void OnSelchangeActionList(); afx_msg void OnDblclkActionList(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptConditions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptConditions.h index 7d8d9397ee4..f51032ee79a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptConditions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptConditions.h @@ -34,7 +34,7 @@ class ScriptConditionsDlg : public CPropertyPage // Construction public: ScriptConditionsDlg(); - ~ScriptConditionsDlg(); + virtual ~ScriptConditionsDlg() override; // Dialog Data //{{AFX_DATA(ScriptConditionsDlg) @@ -48,7 +48,7 @@ class ScriptConditionsDlg : public CPropertyPage // ClassWizard generate virtual function overrides //{{AFX_VIRTUAL(ScriptConditionsDlg) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -71,7 +71,7 @@ class ScriptConditionsDlg : public CPropertyPage protected: // Generated message map functions //{{AFX_MSG(ScriptConditionsDlg) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnEditCondition(); afx_msg void OnSelchangeConditionList(); afx_msg void OnDblclkConditionList(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h index b18a6d978c0..5799c9b9013 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h @@ -62,7 +62,7 @@ class ScriptDialog : public CDialog // Construction public: ScriptDialog(CWnd* pParent = nullptr); // standard constructor - ~ScriptDialog(); // destructor + virtual ~ScriptDialog() override; // destructor // Dialog Data //{{AFX_DATA(ScriptDialog) @@ -75,7 +75,7 @@ class ScriptDialog : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ScriptDialog) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -138,7 +138,7 @@ class ScriptDialog : public CDialog // Generated message map functions //{{AFX_MSG(ScriptDialog) afx_msg void OnSelchangedScriptTree(NMHDR* pNMHDR, LRESULT* pResult); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnNewFolder(); afx_msg void OnNewScript(); afx_msg void OnEditScript(); @@ -150,8 +150,8 @@ class ScriptDialog : public CDialog afx_msg void OnSave(); afx_msg void OnLoad(); afx_msg void OnDblclkScriptTree(NMHDR* pNMHDR, LRESULT* pResult); - virtual void OnOK(); - virtual void OnCancel(); + virtual void OnOK() override; + virtual void OnCancel() override; afx_msg void OnBegindragScriptTree(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnScriptActivate(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptProperties.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptProperties.h index 49d0b001ded..39d06b79482 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptProperties.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptProperties.h @@ -31,7 +31,7 @@ class ScriptProperties : public CPropertyPage // Construction public: ScriptProperties(); - ~ScriptProperties(); + virtual ~ScriptProperties() override; // Dialog Data //{{AFX_DATA(ScriptProperties) @@ -45,9 +45,9 @@ class ScriptProperties : public CPropertyPage // ClassWizard generate virtual function overrides //{{AFX_VIRTUAL(ScriptProperties) public: - virtual BOOL OnSetActive(); + virtual BOOL OnSetActive() override; protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h b/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h index e5383b6f01b..bd21f74fa36 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h @@ -41,8 +41,8 @@ class SelectMacrotexture : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(SelectMacrotexture) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL protected: @@ -54,7 +54,7 @@ class SelectMacrotexture : public CDialog // Generated message map functions //{{AFX_MSG(SelectMacrotexture) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h index 25aa98d8294..31743aa15d4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h @@ -41,7 +41,7 @@ class ShadowOptions : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ShadowOptions) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -60,7 +60,7 @@ class ShadowOptions : public CDialog afx_msg void OnChangeBaEdit(); afx_msg void OnChangeGaEdit(); afx_msg void OnChangeRaEdit(); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamBehavior.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamBehavior.h index 67134dedadf..bc553f79f50 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamBehavior.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamBehavior.h @@ -41,7 +41,7 @@ class TeamBehavior : public CPropertyPage // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TeamBehavior) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -57,7 +57,7 @@ class TeamBehavior : public CPropertyPage // Generated message map functions //{{AFX_MSG(TeamBehavior) afx_msg void OnSelchangeOnCreateScript(); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnTransportsReturn(); afx_msg void OnAvoidThreats(); afx_msg void OnSelchangeOnEnemySighted(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamGeneric.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamGeneric.h index a180fa298d8..c8c79ac1b61 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamGeneric.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamGeneric.h @@ -40,7 +40,7 @@ class TeamGeneric : public CPropertyPage protected: // Windows Functions - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void _scriptsToDict(); afx_msg void OnScriptAdjust(); DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamIdentity.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamIdentity.h index 2fee1ad6b69..a1ab9376eb6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamIdentity.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamIdentity.h @@ -43,8 +43,8 @@ class TeamIdentity : public CPropertyPage // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TeamIdentity) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam) override; //}}AFX_VIRTUAL protected: @@ -64,7 +64,7 @@ class TeamIdentity : public CPropertyPage // Generated message map functions //{{AFX_MSG(TeamIdentity) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnAiRecruitable(); afx_msg void OnAutoReinforce(); afx_msg void OnBaseDefense(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h index a8d80c8dc6d..87fc7f27fad 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h @@ -36,7 +36,7 @@ class TeamObjectProperties : public CPropertyPage // Construction public: TeamObjectProperties(Dict* dictToEdit = nullptr); - ~TeamObjectProperties(); + virtual ~TeamObjectProperties() override; // Dialog Data //{{AFX_DATA(MapObjectProps) @@ -48,8 +48,8 @@ class TeamObjectProperties : public CPropertyPage // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TeamObjectProperties) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam) override; //}}AFX_VIRTUAL // Implementation diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamReinforcement.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamReinforcement.h index bdf0bc025ae..fde0bc9de5b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamReinforcement.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamReinforcement.h @@ -41,7 +41,7 @@ class TeamReinforcement : public CPropertyPage // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TeamReinforcement) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation @@ -59,7 +59,7 @@ class TeamReinforcement : public CPropertyPage afx_msg void OnTransportsExit(); afx_msg void OnSelchangeVeterancy(); afx_msg void OnSelchangeWaypointCombo(); - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h index 9e92a4032dc..c9cf45d6736 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h @@ -45,10 +45,10 @@ class TerrainMaterial : public COptionsPanel, public PopupSliderOwner // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TerrainMaterial) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual void OnOK(){return;}; ///< Modeless dialogs don't OK, so eat this for modeless. - virtual void OnCancel(){return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual void OnOK() override {return;}; ///< Modeless dialogs don't OK, so eat this for modeless. + virtual void OnCancel() override {return;}; ///< Modeless dialogs don't close on ESC, so eat this for modeless. + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -56,7 +56,7 @@ class TerrainMaterial : public COptionsPanel, public PopupSliderOwner enum {MIN_TILE_SIZE=2, MAX_TILE_SIZE = 100}; // Generated message map functions //{{AFX_MSG(TerrainMaterial) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; afx_msg void OnSwapTextures(); afx_msg void OnChangeSizeEdit(); afx_msg void OnImpassable(); @@ -102,9 +102,9 @@ class TerrainMaterial : public COptionsPanel, public PopupSliderOwner Bool setTerrainTreeViewSelection(HTREEITEM parent, Int selection); // Popup slider interface. - virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial); - virtual void PopSliderChanged(const long sliderID, long theVal); - virtual void PopSliderFinished(const long sliderID, long theVal); + virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial) override; + virtual void PopSliderChanged(const long sliderID, long theVal) override; + virtual void PopSliderFinished(const long sliderID, long theVal) override; }; //{{AFX_INSERT_LOCATION}} diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h index 0154e392786..f40e639d9fd 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h @@ -44,8 +44,8 @@ class TerrainModal : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TerrainModal) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; //}}AFX_VIRTUAL // Implementation @@ -53,7 +53,7 @@ class TerrainModal : public CDialog // Generated message map functions //{{AFX_MSG(TerrainModal) - virtual BOOL OnInitDialog(); + virtual BOOL OnInitDialog() override; //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainSwatches.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainSwatches.h index d7174476e61..2c9e599882b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainSwatches.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainSwatches.h @@ -44,7 +44,7 @@ class TerrainSwatches : public CWnd // Implementation public: - virtual ~TerrainSwatches(); + virtual ~TerrainSwatches() override; // Generated message map functions protected: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TileTool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TileTool.h index c42d23e415c..475b5ef99b8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TileTool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TileTool.h @@ -36,14 +36,14 @@ class TileTool : public Tool public: TileTool(void); - ~TileTool(void); + virtual ~TileTool(void) override; public: - virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc); - virtual WorldHeightMapEdit *getHeightMap(void) {return m_htMapEditCopy;}; - virtual void activate(); ///< Become the current tool. + virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) override; + virtual WorldHeightMapEdit *getHeightMap(void) override {return m_htMapEditCopy;}; + virtual void activate() override; ///< Become the current tool. virtual Int getWidth(void) {return 1;}; }; @@ -57,12 +57,12 @@ class BigTileTool : public TileTool static Int m_currentWidth; public: - virtual void activate(); ///< Become the current tool. + virtual void activate() override; ///< Become the current tool. public: BigTileTool(void); static void setWidth(Int width) ; - virtual Int getWidth(void) {return m_currentWidth;}; + virtual Int getWidth(void) override {return m_currentWidth;}; }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h index 5933bc1e9b1..37d682543f6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h @@ -42,13 +42,13 @@ class CWBFrameWnd : public CFrameWnd virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = nullptr, - CCreateContext* pContext = nullptr); + CCreateContext* pContext = nullptr) override; // ClassWizard generated virtual function overrides //}}AFX_VIRTUAL // Implementation protected: - virtual ~CWBFrameWnd(); + virtual ~CWBFrameWnd() override; // Generated message map functions //{{AFX_MSG(CWBFrameWnd) @@ -71,14 +71,14 @@ class CWB3dFrameWnd : public CMainFrame virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = nullptr, - CCreateContext* pContext = nullptr); + CCreateContext* pContext = nullptr) override; // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWB3dFrameWnd) public: //}}AFX_VIRTUAL // Implementation protected: - virtual ~CWB3dFrameWnd(); + virtual ~CWB3dFrameWnd() override; // Generated message map functions //{{AFX_MSG(CWB3dFrameWnd) afx_msg void OnMove(int x, int y); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h index e3dba63db72..8808131fb2b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h @@ -34,8 +34,8 @@ class WBHeightMap : public HeightMapRenderObjClass ///////////////////////////////////////////////////////////////////////////// // Render Object Interface (W3D methods) ///////////////////////////////////////////////////////////////////////////// - virtual void Render(RenderInfoClass & rinfo); - virtual Bool Cast_Ray(RayCollisionTestClass & raytest); + virtual void Render(RenderInfoClass & rinfo) override; + virtual Bool Cast_Ray(RayCollisionTestClass & raytest) override; virtual Real getHeightMapHeight(Real x, Real y, Coord3D* normal); ///getNumSides(); i++) { + for (i=0; igetNumSides(); i++) { SidesInfo *pSide = TheSidesList->getSideInfo(i); Int listSel = 0; for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index 34419e2272f..c4ca7894aa4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -794,7 +794,7 @@ void DictItemUndoable::Do(void) m_dictToModify[i]->copyPairFrom(m_newDictData, m_key); } MapObjectProps::update(); // ugh, hack to update panel - ObjectOptions::update(); // ditto + ObjectOptions::update(); // ditto if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); @@ -811,7 +811,7 @@ void DictItemUndoable::Undo(void) m_dictToModify[i]->copyPairFrom(m_oldDictData[i], m_key); } MapObjectProps::update(); // ugh, hack to update panel - ObjectOptions::update(); // ditto + ObjectOptions::update(); // ditto if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); @@ -1363,7 +1363,7 @@ void DeletePolygonUndoable::Undo(void) // MultipleUndoable - constructor. // MultipleUndoable::MultipleUndoable(void) - : m_undoableList( nullptr ) +: m_undoableList( nullptr ) { } @@ -1372,10 +1372,10 @@ MultipleUndoable::MultipleUndoable(void) // MultipleUndoable::~MultipleUndoable(void) { - if ( m_undoableList ) - { - REF_PTR_RELEASE(m_undoableList); - } + if ( m_undoableList ) + { + REF_PTR_RELEASE(m_undoableList); + } } // @@ -1383,9 +1383,9 @@ MultipleUndoable::~MultipleUndoable(void) // void MultipleUndoable::addUndoable( Undoable * undoable ) { - undoable->LinkNext( m_undoableList ); + undoable->LinkNext( m_undoableList ); - REF_PTR_SET( m_undoableList, undoable ); + REF_PTR_SET( m_undoableList, undoable ); } @@ -1394,14 +1394,14 @@ void MultipleUndoable::addUndoable( Undoable * undoable ) // void MultipleUndoable::Do(void) { - Undoable * undoable = m_undoableList; + Undoable * undoable = m_undoableList; - while ( undoable != nullptr ) - { - Undoable * next = undoable->GetNext(); - undoable->Do(); - undoable = next; - } + while ( undoable != nullptr ) + { + Undoable * next = undoable->GetNext(); + undoable->Do(); + undoable = next; + } } @@ -1410,12 +1410,12 @@ void MultipleUndoable::Do(void) // static void undoHelper(Undoable * undoable) { - if ( undoable == nullptr ) - return; + if ( undoable == nullptr ) + return; - undoHelper( undoable->GetNext() ); + undoHelper( undoable->GetNext() ); - undoable->Undo(); + undoable->Undo(); } // @@ -1424,7 +1424,7 @@ static void undoHelper(Undoable * undoable) // void MultipleUndoable::Undo(void) { - undoHelper(m_undoableList); + undoHelper(m_undoableList); } @@ -1433,13 +1433,13 @@ void MultipleUndoable::Undo(void) // void MultipleUndoable::Redo(void) { - Undoable * undoable = m_undoableList; + Undoable * undoable = m_undoableList; - while ( undoable != nullptr ) - { - Undoable * next = undoable->GetNext(); - undoable->Redo(); - undoable = next; - } + while ( undoable != nullptr ) + { + Undoable * next = undoable->GetNext(); + undoable->Redo(); + undoable = next; + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index 6d96e26c0bc..e74cfff2d8f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -298,7 +298,7 @@ void DrawObject::updateMeshVB(void) m_curMeshModelName = MeshMoldOptions::getModelName(); } if (m_moldMesh == nullptr) { - WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); + WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); pMgr->Set_WW3D_Load_On_Demand(false); // We don't want it fishing for these assets in the game assets. m_moldMesh = (MeshClass*)pMgr->Create_Render_Obj(m_curMeshModelName.str()); if (m_moldMesh == nullptr) { @@ -573,7 +573,7 @@ void DrawObject::updateBoundaryVB(void) VertexFormatXYZDUV1 *vb = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array(); VertexFormatXYZDUV1 *curVb = vb; - CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); + CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); Int numBoundaries = pDoc->getNumBoundaries(); Int i, j; @@ -859,13 +859,13 @@ void DrawObject::updateWaypointVB(void) VertexFormatXYZDUV1 *vb = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array(); VertexFormatXYZDUV1 *curVb = vb; - CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); + CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); Int i; for (i = 0; i<=pDoc->getNumWaypointLinks(); i++) { Bool gotLocation=false; Coord3D loc1; Coord3D loc2; - Bool exists; + Bool exists; Int waypointID1, waypointID2; Int k; @@ -1273,10 +1273,10 @@ void DrawObject::updateFeedbackVB(void) if (iAdd_Line(Vector2(start.x, start.y), Vector2(end.x, end.y), width, color); - } - - lastPnt = pnt; - end = start; - shouldEnd = shouldStart; - } + Real angle, inc = PI/4.0f; + Coord3D pnt, lastPnt; + ICoord2D start, end; + Real z = center.z; + + // Draw the circle. + angle = 0.0f; + lastPnt.x = center.x + radius * (Real)cos(angle); + lastPnt.y = center.y + radius * (Real)sin(angle); + lastPnt.z = z; + bool shouldEnd = worldToScreen(&lastPnt, &end, camera); + + for( angle = inc; angle <= 2.0f * PI; angle += inc ) { + pnt.x = center.x + radius * (Real)cos(angle); + pnt.y = center.y + radius * (Real)sin(angle); + pnt.z = z; + + bool shouldStart = worldToScreen(&pnt, &start, camera); + if (shouldStart && shouldEnd) { + m_lineRenderer->Add_Line(Vector2(start.x, start.y), Vector2(end.x, end.y), width, color); + } + + lastPnt = pnt; + end = start; + shouldEnd = shouldStart; + } } @@ -1769,7 +1769,7 @@ void DrawObject::updateVBWithSightRange(MapObject *pMapObj, CameraClass* camera) pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } - addCircleToLineRenderer(pos, radius, SIGHT_RANGE_LINE_WIDTH, color, camera ); + addCircleToLineRenderer(pos, radius, SIGHT_RANGE_LINE_WIDTH, color, camera ); } #define WEAPON_RANGE_LINE_WIDTH 1.0f @@ -1781,7 +1781,7 @@ void DrawObject::updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera return; } - const unsigned long colors[WEAPONSLOT_COUNT] = {0xFF00FF00, 0xFFE0F00A, 0xFFFF0000}; // Green, Yellow, Red + const unsigned long colors[WEAPONSLOT_COUNT] = {0xFF00FF00, 0xFFE0F00A, 0xFFFF0000}; // Green, Yellow, Red Coord3D pos = *pMapObj->getLocation(); @@ -1806,7 +1806,7 @@ void DrawObject::updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera Real radius = tmpl->getUnmodifiedAttackRange(); - addCircleToLineRenderer(pos, radius, WEAPON_RANGE_LINE_WIDTH, colors[i], camera ); + addCircleToLineRenderer(pos, radius, WEAPON_RANGE_LINE_WIDTH, colors[i], camera ); } } } @@ -1816,122 +1816,122 @@ void DrawObject::updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera // MLL C&C3 void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera) { - if (!pMapObj || !m_lineRenderer) { - return; - } - - const unsigned long colors[2] = {0xFF0000FF, 0xFFFF00FF}; // Blue and purple - // Colors match those used in W3DView.cpp - - - Coord3D pos = *pMapObj->getLocation(); - if (TheTerrainRenderObject) { - // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); - } - - // Does this object actually have an attached sound? - const AudioEventInfo * audioInfo = nullptr; - - Dict * properties = pMapObj->getProperties(); - - Bool exists = false; - AsciiString ambientName = properties->getAsciiString( TheKey_objectSoundAmbient, &exists ); - - if ( exists ) - { - if ( ambientName.isEmpty() ) - { - // User has removed normal sound - return; - } - else - { - if ( TheAudio == nullptr ) - { - DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); - return; - } - - audioInfo = TheAudio->findAudioEventInfo( ambientName ); - - if ( audioInfo == nullptr ) - { - DEBUG_CRASH( ("Override audio named %s is missing; Can't draw sound circles", ambientName.str() ) ); - return; - } - } - } - else - { - const ThingTemplate * thingTemplate = pMapObj->getThingTemplate(); - if ( thingTemplate == nullptr ) - { - // No sound if no template - return; - } - - if ( !thingTemplate->hasSoundAmbient() ) - { - return; - } - - const AudioEventRTS * event = thingTemplate->getSoundAmbient(); - - if ( event == nullptr ) - { - return; - } - - audioInfo = event->getAudioEventInfo(); - - if ( audioInfo == nullptr ) - { - // May just not be set up yet - if ( TheAudio == nullptr ) - { - DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); - return; - } - - audioInfo = TheAudio->findAudioEventInfo( event->getEventName() ); - - if ( audioInfo == nullptr ) - { - DEBUG_CRASH( ("Default ambient sound %s has no info; Can't draw sound circles", event->getEventName().str() ) ); - return; - } - } - } - - // Should have set up audioInfo or returned by now - DEBUG_ASSERTCRASH( audioInfo != nullptr, ("Managed to finish setting up audio info without setting it?!?" ) ); - if ( audioInfo == nullptr ) - { - return; - } - - // Get the current radius (could be overridden) - Real minRadius = audioInfo->m_minDistance; - Real maxRadius = audioInfo->m_maxDistance; - Bool customized = properties->getBool( TheKey_objectSoundAmbientCustomized, &exists ); - if ( exists && customized ) - { - Real valReal; - - valReal = properties->getReal( TheKey_objectSoundAmbientMinRange, &exists ); - if ( exists ) - { - minRadius = valReal; - } - valReal = properties->getReal( TheKey_objectSoundAmbientMaxRange, &exists ); - if ( exists ) - { - maxRadius = valReal; - } - } - addCircleToLineRenderer(pos, minRadius, SOUND_RANGE_LINE_WIDTH, colors[0], camera ); - addCircleToLineRenderer(pos, maxRadius, SOUND_RANGE_LINE_WIDTH, colors[1], camera ); + if (!pMapObj || !m_lineRenderer) { + return; + } + + const unsigned long colors[2] = {0xFF0000FF, 0xFFFF00FF}; // Blue and purple + // Colors match those used in W3DView.cpp + + + Coord3D pos = *pMapObj->getLocation(); + if (TheTerrainRenderObject) { + // Make sure that the position is on the terrain. + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); + } + + // Does this object actually have an attached sound? + const AudioEventInfo * audioInfo = nullptr; + + Dict * properties = pMapObj->getProperties(); + + Bool exists = false; + AsciiString ambientName = properties->getAsciiString( TheKey_objectSoundAmbient, &exists ); + + if ( exists ) + { + if ( ambientName.isEmpty() ) + { + // User has removed normal sound + return; + } + else + { + if ( TheAudio == nullptr ) + { + DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); + return; + } + + audioInfo = TheAudio->findAudioEventInfo( ambientName ); + + if ( audioInfo == nullptr ) + { + DEBUG_CRASH( ("Override audio named %s is missing; Can't draw sound circles", ambientName.str() ) ); + return; + } + } + } + else + { + const ThingTemplate * thingTemplate = pMapObj->getThingTemplate(); + if ( thingTemplate == nullptr ) + { + // No sound if no template + return; + } + + if ( !thingTemplate->hasSoundAmbient() ) + { + return; + } + + const AudioEventRTS * event = thingTemplate->getSoundAmbient(); + + if ( event == nullptr ) + { + return; + } + + audioInfo = event->getAudioEventInfo(); + + if ( audioInfo == nullptr ) + { + // May just not be set up yet + if ( TheAudio == nullptr ) + { + DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); + return; + } + + audioInfo = TheAudio->findAudioEventInfo( event->getEventName() ); + + if ( audioInfo == nullptr ) + { + DEBUG_CRASH( ("Default ambient sound %s has no info; Can't draw sound circles", event->getEventName().str() ) ); + return; + } + } + } + + // Should have set up audioInfo or returned by now + DEBUG_ASSERTCRASH( audioInfo != nullptr, ("Managed to finish setting up audio info without setting it?!?" ) ); + if ( audioInfo == nullptr ) + { + return; + } + + // Get the current radius (could be overridden) + Real minRadius = audioInfo->m_minDistance; + Real maxRadius = audioInfo->m_maxDistance; + Bool customized = properties->getBool( TheKey_objectSoundAmbientCustomized, &exists ); + if ( exists && customized ) + { + Real valReal; + + valReal = properties->getReal( TheKey_objectSoundAmbientMinRange, &exists ); + if ( exists ) + { + minRadius = valReal; + } + valReal = properties->getReal( TheKey_objectSoundAmbientMaxRange, &exists ); + if ( exists ) + { + maxRadius = valReal; + } + } + addCircleToLineRenderer(pos, minRadius, SOUND_RANGE_LINE_WIDTH, colors[0], camera ); + addCircleToLineRenderer(pos, maxRadius, SOUND_RANGE_LINE_WIDTH, colors[1], camera ); } @@ -2095,7 +2095,7 @@ if (_skip_drawobject_render) { } m_waterDrawObject->update(); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile1); - if (m_drawObjects || m_drawWaypoints || m_drawBoundingBoxes || m_drawSightRanges || m_drawWeaponRanges || m_drawSoundRanges || m_drawTestArtHighlight) { + if (m_drawObjects || m_drawWaypoints || m_drawBoundingBoxes || m_drawSightRanges || m_drawWeaponRanges || m_drawSoundRanges || m_drawTestArtHighlight) { //Apply the shader and material //WST Variables below are for optimization to reduce VB updates which are extremely slow @@ -2112,7 +2112,7 @@ if (_skip_drawobject_render) { // DEBUG! if (pMapObj->isSelected()) { - Transform.Get_Translation(); + Transform.Get_Translation(); } Coord3D loc = *pMapObj->getLocation(); if (TheTerrainRenderObject) { @@ -2149,10 +2149,10 @@ if (pMapObj->isSelected()) { linesToRender = true; updateVBWithWeaponRange(pMapObj, &rinfo.Camera); } - if (doArrow && m_drawSoundRanges) { - linesToRender = true; - updateVBWithSoundRanges(pMapObj, &rinfo.Camera); - } + if (doArrow && m_drawSoundRanges) { + linesToRender = true; + updateVBWithSoundRanges(pMapObj, &rinfo.Camera); + } } if (doArrow && m_drawTestArtHighlight) { @@ -2227,7 +2227,7 @@ if (pMapObj->isSelected()) { } } if (m_drawPolygonAreas) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); + DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); Int selected; for (selected = 0; selected < 2; selected++) { for (PolygonTrigger *pTrig=PolygonTrigger::getFirstPolygonTrigger(); pTrig; pTrig = pTrig->getNext()) { @@ -2281,7 +2281,7 @@ if (pMapObj->isSelected()) { DX8Wrapper::Set_Transform(D3DTS_WORLD,tmReset); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile1); updatePolygonVB(pTrig, polySelected, polySelected && PolygonTool::isSelectedOpen()); - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); if (m_feedbackIndexCount>0) { DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Draw_Triangles( 0, m_feedbackIndexCount/3, 0, m_feedbackVertexCount); @@ -2292,7 +2292,7 @@ if (pMapObj->isSelected()) { } - if (BuildListTool::isActive()) for (i=0; igetNumSides(); i++) { + if (BuildListTool::isActive()) for (i=0; igetNumSides(); i++) { SidesInfo *pSide = TheSidesList->getSideInfo(i); for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { Coord3D loc = *pBuild->getLocation(); @@ -2338,19 +2338,19 @@ if (pMapObj->isSelected()) { } DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); + DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); Matrix3D tmReset(Transform); DX8Wrapper::Set_Transform(D3DTS_WORLD,tmReset); if (m_drawWaypoints) { updateWaypointVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(m_shaderClass); DX8Wrapper::Draw_Triangles( 0, m_feedbackIndexCount/3, 0, m_feedbackVertexCount); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); + DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); } } @@ -2360,7 +2360,7 @@ if (pMapObj->isSelected()) { if (m_meshFeedback) { updateMeshVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(SC_OPAQUE_Z); DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_WIREFRAME); @@ -2369,7 +2369,7 @@ if (pMapObj->isSelected()) { } else if (m_toolWantsFeedback && !m_disableFeedback) { updateFeedbackVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(ShaderClass::_PresetAlpha2DShader); DX8Wrapper::Draw_Triangles( 0, m_feedbackIndexCount/3, 0, m_feedbackVertexCount); @@ -2381,7 +2381,7 @@ if (pMapObj->isSelected()) { if (m_rampFeedback) { updateRampVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(SC_OPAQUE_Z); DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_WIREFRAME); // we want a solid ramp @@ -2395,7 +2395,7 @@ if (pMapObj->isSelected()) { if (m_boundaryFeedback) { updateBoundaryVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(m_shaderClass); DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, D3DCULL_NONE); @@ -2413,7 +2413,7 @@ if (pMapObj->isSelected()) { if (m_ambientSoundFeedback) { updateAmbientSoundVB(); if (m_feedbackIndexCount>0) { - DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); + DX8Wrapper::Set_Vertex_Buffer(m_vertexFeedback); DX8Wrapper::Set_Index_Buffer(m_indexFeedback,0); DX8Wrapper::Set_Shader(m_shaderClass); DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, D3DCULL_NONE); @@ -2423,8 +2423,8 @@ if (pMapObj->isSelected()) { } } - DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); + DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); + DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferWater); if (m_waterDrawObject) { m_waterDrawObject->renderWater(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp index e1e31053733..4622e9901df 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp @@ -221,7 +221,7 @@ void EditAction::formatScriptActionText(Int parameterNdx) { m_myEditCtrl.SetSel(0, 1000); m_myEditCtrl.SetSelectionCharFormat(cf); - //m_myEditCtrl.SetReadOnly(); + //m_myEditCtrl.SetReadOnly(); // Set up the links. cf.dwMask = CFE_UNDERLINE | CFM_LINK | CFM_COLOR; @@ -346,7 +346,7 @@ BOOL EditAction::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) AsciiString strings[MAX_PARMS]; Int numStrings = m_action->getUiStrings(strings); Int i; - Bool match = false; + Bool match = false; for (i=0; igetUiStrings(strings); Int i; - Bool match = false; + Bool match = false; for (i=0; ipointSize; char buffer[33]; - itoa( size, buffer, 10 ); + itoa( size, buffer, 10 ); string.concat( buffer ); if( font->bold ) string.concat( " [Bold]" ); @@ -1923,7 +1923,7 @@ BOOL EditParameter::OnInitDialog() break; - case Parameter::LEFT_OR_RIGHT: + case Parameter::LEFT_OR_RIGHT: captionText = "Evacuate Container Side Choices:"; pList->InsertString(-1,"Left"); pList->InsertString(-1,"Right"); @@ -2265,9 +2265,9 @@ void EditParameter::OnOK() break; - case Parameter::LEFT_OR_RIGHT: - m_parameter->friend_setInt(pList->GetCurSel() + 1); - break; + case Parameter::LEFT_OR_RIGHT: + m_parameter->friend_setInt(pList->GetCurSel() + 1); + break; case Parameter::LOCALIZED_TEXT: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 0ca2889702c..6bf693a596a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -559,7 +559,7 @@ void GlobalLightOptions::stuffValuesIntoFields(Int lightIndex) if (azimuth < 0) { azimuth += 360; } - Real angleElevation = acos(light.Z);//WWMath::Asin(light.X); + Real angleElevation = acos(light.Z);//WWMath::Asin(light.X); elevation = (angleElevation-PI/2.0f)*180.0f/PI;//90-(angleLR/PI)*180; m_angleElevation[lightIndex] = elevation; @@ -569,7 +569,7 @@ void GlobalLightOptions::stuffValuesIntoFields(Int lightIndex) m_updating = true; CString str; - str.Format("XYZ: %.2f, %.2f, %.2f", light.X, light.Y, light.Z); + str.Format("XYZ: %.2f, %.2f, %.2f", light.X, light.Y, light.Z); CWnd *pWnd = this->GetDlgItem(IDC_XYZ_STATIC); if (pWnd && lightIndex==0) { pWnd->SetWindowText(str); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp index f86005ddfa8..1afb37cda76 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp @@ -87,7 +87,7 @@ CMainFrame::~CMainFrame() TheMainFrame = nullptr; ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSave", m_autoSave); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSaveIntervalSeconds", m_autoSaveInterval); - CoUninitialize(); + CoUninitialize(); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) @@ -139,7 +139,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) TRACE0("Failed to create toolbar\n"); return -1; // fail to create } - m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP); + m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP); frameRect.left = frameRect.right; frameRect.top = ::AfxGetApp()->GetProfileInt(OPTIONS_PANEL_SECTION, "Top", frameRect.top); @@ -211,56 +211,56 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_roadOptions.Create(IDD_ROAD_OPTIONS, this); m_roadOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_roadOptions.GetWindowRect(&frameRect); + m_roadOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waypointOptions.Create(IDD_WAYPOINT_OPTIONS, this); m_waypointOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_waypointOptions.GetWindowRect(&frameRect); + m_waypointOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waterOptions.Create(IDD_WATER_OPTIONS, this); m_waterOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_waterOptions.GetWindowRect(&frameRect); + m_waterOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_lightOptions.Create(IDD_LIGHT_OPTIONS, this); m_lightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_lightOptions.GetWindowRect(&frameRect); + m_lightOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_meshMoldOptions.Create(IDD_MESHMOLD_OPTIONS, this); m_meshMoldOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_meshMoldOptions.GetWindowRect(&frameRect); + m_meshMoldOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_buildListOptions.Create(IDD_BUILD_LIST_PANEL, this); m_buildListOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_buildListOptions.GetWindowRect(&frameRect); + m_buildListOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_groveOptions.Create(IDD_GROVE_OPTIONS, this); m_groveOptions.makeMain(); m_groveOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_groveOptions.GetWindowRect(&frameRect); + m_groveOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_rampOptions.Create(IDD_RAMP_OPTIONS, this); m_rampOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_rampOptions.GetWindowRect(&frameRect); + m_rampOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_scorchOptions.Create(IDD_SCORCH_OPTIONS, this); m_scorchOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_scorchOptions.GetWindowRect(&frameRect); + m_scorchOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); @@ -269,7 +269,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_globalLightOptions.Create(IDD_GLOBAL_LIGHT_OPTIONS, this); m_globalLightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_globalLightOptions.GetWindowRect(&frameRect); + m_globalLightOptions.GetWindowRect(&frameRect); m_globalLightOptionsWidth = frameRect.Width(); m_globalLightOptionsHeight = frameRect.Height(); @@ -278,7 +278,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_cameraOptions.Create(IDD_CAMERA_OPTIONS, this); m_cameraOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_cameraOptions.GetWindowRect(&frameRect); + m_cameraOptions.GetWindowRect(&frameRect); // now, setup the Layers Panel m_layersList = new LayersList(LayersList::IDD, this); @@ -434,7 +434,7 @@ void CMainFrame::onEditScripts() m_scriptDialog = new ScriptDialog(this); m_scriptDialog->Create(IDD_ScriptDialog, this); m_scriptDialog->SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); - m_scriptDialog->GetWindowRect(&frameRect); + m_scriptDialog->GetWindowRect(&frameRect); m_scriptDialog->ShowWindow(SW_SHOWNA); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index d97e2bfc42d..589609eb06d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -121,8 +121,8 @@ BOOL MeshMoldOptions::OnInitDialog() ++it; } while (it != filenameList.end()); - if (child) m_moldTreeView.SelectItem(child); - } + if (child) m_moldTreeView.SelectItem(child); + } } m_staticThis = this; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index dcc8db44aa0..3d9873bea77 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -314,7 +314,7 @@ BOOL ObjectOptions::OnInitDialog() ++it; } while (it != filenameList.end()); - } + } } #endif diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp index ecbeace38ed..11e1a48cc9c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp @@ -199,7 +199,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) if( modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) ) { - WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); + WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); model = pMgr->Create_Render_Obj(modelName.str()); if (model) { @@ -296,7 +296,7 @@ void ObjectPreview::DrawMyTexture(CDC *pDc, int top, int left, Int width, Int he LPBITMAPINFO pBI; // long bytes = sizeof(BITMAPINFO); - pBI = new BITMAPINFO; + pBI = new BITMAPINFO; pBI->bmiHeader.biSize = sizeof(pBI->bmiHeader); pBI->bmiHeader.biWidth = PREVIEW_WIDTH; pBI->bmiHeader.biHeight = PREVIEW_HEIGHT; /* match display top left == 0,0 */ diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp index c003e493bd0..a2467036e45 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp @@ -150,7 +150,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) } while (FindNextFile(hFindFile, &findData)); if (hFindFile) FindClose(hFindFile); - } + } if (found) { pList->SetCurSel(0); } else { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp index f3c0d23d12f..88688e7f140 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -276,7 +276,7 @@ BOOL RoadOptions::OnInitDialog() ++it; } while (it != filenameList.end()); - } + } } #endif diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp index 8b1fddc82ad..ecbf28bd5a6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp @@ -146,7 +146,7 @@ void RulerTool::setLength(Real length) } CString str; - str.Format("Diameter (in feet): %f", length * 2.0f); + str.Format("Diameter (in feet): %f", length * 2.0f); CMainFrame::GetMainFrame()->SetMessageText(str); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp index dd6ea4751fb..63d959dc59f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp @@ -161,7 +161,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) } while (FindNextFile(hFindFile, &findData)); if (hFindFile) FindClose(hFindFile); - } + } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_SAVE_MAP_EDIT); if (pEdit != nullptr) { strlcpy(fileBuf, m_pInfo->filename, ARRAY_SIZE(fileBuf)); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp index e98375ed77f..d8b7c2b73d1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp @@ -1109,7 +1109,7 @@ void ScriptDialog::OnDelete() m_curSelection.m_objType = ListType::PLAYER_TYPE; } } - reloadPlayer(m_curSelection.m_playerIndex, pSL); + reloadPlayer(m_curSelection.m_playerIndex, pSL); updateSelection(m_curSelection); } updateIcons(TVI_ROOT); @@ -1121,7 +1121,7 @@ class LocalMFCFileOutputStream : public OutputStream CFile *m_file; public: LocalMFCFileOutputStream(CFile *pFile):m_file(pFile) {}; - virtual Int write(const void *pData, Int numBytes) { + virtual Int write(const void *pData, Int numBytes) override { Int numBytesWritten = 0; try { m_file->Write(pData, numBytes); @@ -1577,7 +1577,7 @@ void ScriptDialog::OnLoad() Int j; for (j=0; jgetDict()->getAsciiString(TheKey_playerName); + AsciiString name = m_sides.getSideInfo(i)->getDict()->getAsciiString(TheKey_playerName); if (name == m_readPlayerNames[j]) { curSide = j; break; @@ -1633,7 +1633,7 @@ void ScriptDialog::OnLoad() } catch(...) { - DEBUG_CRASH(("threw exception in ScriptDialog::OnLoad")); + DEBUG_CRASH(("threw exception in ScriptDialog::OnLoad")); } } @@ -1703,7 +1703,7 @@ Bool ScriptDialog::ParseObjectDataChunk(DataChunkInput &file, DataChunkInfo *inf AsciiString warning; warning.format("Duplicate named waypoints '%s', renaming imported waypoint.", pThisOne->getWaypointName().str()); ::AfxMessageBox(warning.str(), MB_OK); - AsciiString name = WaypointOptions::GenerateUniqueName(pThisOne->getWaypointID()); + AsciiString name = WaypointOptions::GenerateUniqueName(pThisOne->getWaypointID()); name.concat("-imp"); } } @@ -1952,9 +1952,9 @@ void ScriptDialog::OnBegindragScriptTree(NMHDR* pNMHDR, LRESULT* pResult) m_curSelection.IntToList(pNMTreeView->itemNew.lParam); if (m_curSelection.m_objType != ListType::PLAYER_TYPE) { m_dragItem = pNMTreeView->itemNew.hItem; - pTree->SelectItem(m_dragItem); + pTree->SelectItem(m_dragItem); m_draggingTreeView = true; - SetCapture(); + SetCapture(); } *pResult = 0; } @@ -1964,16 +1964,16 @@ void ScriptDialog::OnMouseMove(UINT nFlags, CPoint point) if (m_draggingTreeView) { CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); - HTREEITEM htiTarget; // handle to target item - TVHITTESTINFO tvht; // hit test information + HTREEITEM htiTarget; // handle to target item + TVHITTESTINFO tvht; // hit test information const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; - tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { + tvht.pt = point; + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { pTree->SelectDropTarget(htiTarget); - } - } + } + } CDialog::OnMouseMove(nFlags, point); } @@ -1985,17 +1985,17 @@ void ScriptDialog::OnLButtonUp(UINT nFlags, CPoint point) m_draggingTreeView = false; ReleaseCapture(); - HTREEITEM htiTarget; // handle to target item - TVHITTESTINFO tvht; // hit test information + HTREEITEM htiTarget; // handle to target item + TVHITTESTINFO tvht; // hit test information const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; - tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { - pTree->SelectItem(htiTarget); + tvht.pt = point; + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { + pTree->SelectItem(htiTarget); pTree->SelectDropTarget(htiTarget); doDropOn(m_dragItem, htiTarget); - } + } } CDialog::OnLButtonUp(nFlags, point); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index 9bb7546994a..73bd3e7ad05 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -108,7 +108,7 @@ BOOL SelectMacrotexture::OnInitDialog() ins.item.cchTextMax = strlen(defaultText); child = m_textureTreeView.InsertItem(&ins); - } + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp index 0a0a98420dd..c9e56516d23 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp @@ -65,7 +65,7 @@ BEGIN_MESSAGE_MAP(TeamObjectProperties, CPropertyPage) ON_EN_KILLFOCUS(IDC_MAPOBJECT_VisionDistance, _VisibilityToDict) ON_EN_KILLFOCUS(IDC_MAPOBJECT_ShroudClearingDistance, _ShroudClearingDistanceToDict) ON_CBN_SELCHANGE(IDC_MAPOBJECT_Veterancy, _VeterancyToDict) - ON_BN_CLICKED(IDC_MAPOBJECT_RecruitableAI, _RecruitableAIToDict) + ON_BN_CLICKED(IDC_MAPOBJECT_RecruitableAI, _RecruitableAIToDict) ON_BN_CLICKED(IDC_MAPOBJECT_Selectable, _SelectableToDict) ON_CBN_SELCHANGE(IDC_MAPOBJECT_Weather, _WeatherToDict) ON_CBN_SELCHANGE(IDC_MAPOBJECT_Time, _TimeToDict) @@ -343,14 +343,14 @@ void TeamObjectProperties::_DictToShroudClearingDistance(void) void TeamObjectProperties::_DictToRecruitableAI(void) { - Bool recruitableAI = true; - Bool exists; - if (m_dictToEdit) { + Bool recruitableAI = true; + Bool exists; + if (m_dictToEdit) { recruitableAI = m_dictToEdit->getBool(TheKey_teamObjectRecruitableAI, &exists); - } + } - CButton* pItem = (CButton*) GetDlgItem(IDC_MAPOBJECT_RecruitableAI); - if (pItem) { + CButton* pItem = (CButton*) GetDlgItem(IDC_MAPOBJECT_RecruitableAI); + if (pItem) { pItem->SetCheck(recruitableAI); } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index 3ba4c7d028e..5fcfbc30e04 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -306,7 +306,7 @@ void TerrainMaterial::addTerrain(char *pPath, Int terrainNdx, HTREEITEM parent) doAdd = TRUE; } - else if (!WorldHeightMapEdit::getTexClassIsBlendEdge(terrainNdx)) + else if (!WorldHeightMapEdit::getTexClassIsBlendEdge(terrainNdx)) { // all these old entries we will put in a tree for eval textures diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainSwatches.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainSwatches.cpp index f95f55c2574..431471d3635 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainSwatches.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainSwatches.cpp @@ -94,7 +94,7 @@ void TerrainSwatches::DrawMyTexture(CDC *pDc, int top, int left, Int width, Unsi LPBITMAPINFO pBI; // long bytes = sizeof(BITMAPINFO); - pBI = new BITMAPINFO; + pBI = new BITMAPINFO; pBI->bmiHeader.biSize = sizeof(pBI->bmiHeader); pBI->bmiHeader.biWidth = width; pBI->bmiHeader.biHeight = width; /* match display top left == 0,0 */ diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp index ce5ddac5561..e2c708e06cc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp @@ -71,7 +71,7 @@ void WBHeightMap::setFlattenHeights(Bool flat) #ifndef USE_FLAT_HEIGHT_MAP m_originX = 0; m_originY = 0; - updateBlock(0, 0, m_x-1, m_y-1, m_map, nullptr); + updateBlock(0, 0, m_x-1, m_y-1, m_map, nullptr); #endif } } @@ -165,10 +165,10 @@ Bool WBHeightMap::Cast_Ray(RayCollisionTestClass & raytest) CastResultStruct result; Int StartCellX; Int EndCellX; - Int StartCellY; + Int StartCellY; Int EndCellY; const Int overhang = 2*32; // Allow picking past the edge for scrolling & objects. - Vector3 minPt(MAP_XY_FACTOR*(-overhang), MAP_XY_FACTOR*(-overhang), -MAP_XY_FACTOR); + Vector3 minPt(MAP_XY_FACTOR*(-overhang), MAP_XY_FACTOR*(-overhang), -MAP_XY_FACTOR); Vector3 maxPt(MAP_XY_FACTOR*(m_map->getXExtent()+overhang), MAP_XY_FACTOR*(m_map->getYExtent()+overhang), MAP_HEIGHT_SCALE*m_map->getMaxHeightValue()+MAP_XY_FACTOR); MinMaxAABoxClass mmbox(minPt, maxPt); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 63bbb234491..8e222693966 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -388,9 +388,9 @@ void WorldHeightMapEdit::loadBitmap(char *path, const char *uiName) void WorldHeightMapEdit::loadBaseImages(void) { - /// @todo - take this out when we are done evaluating terrain textures. + /// @todo - take this out when we are done evaluating terrain textures. #if defined(RTS_DEBUG) - loadDirectoryOfImages("..\\TestArt\\TestTerrain"); + loadDirectoryOfImages("..\\TestArt\\TestTerrain"); #endif // load terrain types from INI definitions @@ -770,7 +770,7 @@ void WorldHeightMapEdit::saveToFile(DataChunkOutput &chunkWriter) chunkWriter.writeReal(TheGlobalData->m_terrainLighting[i+TIME_OF_DAY_FIRST][j].lightPos.z); } } - chunkWriter.writeInt(TheW3DShadowManager->getShadowColor()); + chunkWriter.writeInt(TheW3DShadowManager->getShadowColor()); chunkWriter.closeDataChunk(); @@ -1485,7 +1485,7 @@ Bool WorldHeightMapEdit::floodFill(Int xIndex, Int yIndex, Int textureClass, Boo if (doReplace) { for (i=0; im_next; pCurNode->m_next = nullptr; Int ndx = (pCurNode->m_y*m_width)+pCurNode->m_x; @@ -1524,7 +1524,7 @@ Bool WorldHeightMapEdit::floodFill(Int xIndex, Int yIndex, Int textureClass, Boo for (j=pCurNode->m_y-1; jm_y+2; j++) { if (j<0) continue; if (j>=m_height-1) continue; - ndx = (j*m_width)+i; + ndx = (j*m_width)+i; blendNdx = m_blendTileNdxes[ndx]; if (curTileClass != getTextureClass(i,j,true)) { /* Check blend */ @@ -1859,7 +1859,7 @@ Bool WorldHeightMapEdit::resize(Int newXSize, Int newYSize, Int newHeight, Int n delete(m_cellCliffState); delete(m_cellFlipState); Int numBytesX = (m_width+7)/8; //how many bytes to fit all bitflags - m_flipStateWidth=numBytesX; + m_flipStateWidth=numBytesX; m_cellFlipState = MSGNEW("WorldHeightMapEdit::resize") UnsignedByte[numBytesX*m_height]; m_cellCliffState = MSGNEW("WorldHeightMapEdit::resize") UnsignedByte[numBytesX*m_height]; @@ -2289,7 +2289,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (deltaH>maxH)maxH = deltaH; deltaH = IABS(h2-h3); if (deltaH>maxH)maxH = deltaH; - deltaH = IABS(h3-h0); + deltaH = IABS(h3-h0); if (deltaH>maxH)maxH = deltaH; Bool isCliff = maxH*HEIGHT_SCALE > STRETCH_LIMIT/2.0f; @@ -2438,7 +2438,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (i!=pCurNode->m_x && j!=pCurNode->m_y) continue; if (j<0) continue; if (j>=m_height-1) continue; - ndx = (j*m_width)+i; + ndx = (j*m_width)+i; if (pProcessed[ndx]) continue; CProcessNode *pNewNode = new CProcessNode(i,j); DEBUG_LOG(("Adding node %d, %d", i, j)); @@ -2519,7 +2519,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) Real vDelta = (-textureClassExtent/2) - (uvRange.hi.y + uvRange.lo.y)/2; for (i=0; i=m_height-1) continue; - Int ndx = (j*m_width)+i; + Int ndx = (j*m_width)+i; if (!pProcessed[ndx]) continue; if (m_cliffInfoNdxes[ndx]) { TCliffInfo info = m_cliffInfo[m_cliffInfoNdxes[ndx]]; @@ -3113,7 +3113,7 @@ void WorldHeightMapEdit::updateFlatCellForAdjacentCliffs(Int xIndex, Int yIndex, if (i!=xIndex && j!=yIndex) continue; if (j<0) continue; if (j>=m_height-1) continue; - Int ndx = (j*m_width)+i; + Int ndx = (j*m_width)+i; if (m_cliffInfoNdxes[ndx]) { TCliffInfo info = m_cliffInfo[m_cliffInfoNdxes[ndx]]; okToProcess = true; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp index f197ac0d9e2..e4751a2082f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp @@ -335,7 +335,7 @@ PolygonTrigger * WaterOptions::adjustCount(PolygonTrigger *trigger, Int firstPt, curSpacingLen = spacing; } curSpacingLen -= curLen; - if ((curLen)Write(pData, numBytes); @@ -184,7 +184,7 @@ class CachedMFCFileOutputStream : public OutputStream Int m_totalBytes; public: CachedMFCFileOutputStream(CFile *pFile):m_file(pFile), m_totalBytes(0) {}; - virtual Int write(const void *pData, Int numBytes) { + virtual Int write(const void *pData, Int numBytes) override { UnsignedByte *tmp = new UnsignedByte[numBytes]; memcpy(tmp, pData, numBytes); CachedChunk c; @@ -218,7 +218,7 @@ class CompressedCachedMFCFileOutputStream : public OutputStream Int m_totalBytes; public: CompressedCachedMFCFileOutputStream(CFile *pFile):m_file(pFile), m_totalBytes(0) {}; - virtual Int write(const void *pData, Int numBytes) { + virtual Int write(const void *pData, Int numBytes) override { UnsignedByte *tmp = new UnsignedByte[numBytes]; memcpy(tmp, pData, numBytes); CachedChunk c; @@ -1569,7 +1569,7 @@ void CWorldBuilderDoc::getObjArrowPoint(MapObject *pObj, Coord3D *location) { // Get the center location, and the angle. Coord3D loc = *pObj->getLocation(); - float angle = pObj->getAngle(); + float angle = pObj->getAngle(); // The arrow starts in the +x direction. Vector3 arrow(1.2f*MAP_XY_FACTOR, 0, 0); // Rotate diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp index 671787ff327..0e1171ed966 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp @@ -304,7 +304,7 @@ void CWorldBuilderView::OnPaint() maxJ = pMap->getYExtent() - min; minJ = pMap->getYExtent() - max; - if (maxJ>=pMap->getYExtent()) maxJ = pMap->getYExtent()-1; + if (maxJ>=pMap->getYExtent()) maxJ = pMap->getYExtent()-1; } @@ -477,7 +477,7 @@ void CWorldBuilderView::drawObjectInView(CDC *pDc, MapObject *pMapObj) Int delta = (m_cellSize+4)/4; Int smallDelta = (delta+4)/4; - float angle = pMapObj->getAngle(); + float angle = pMapObj->getAngle(); Vector3 head1(m_cellSize - delta, smallDelta, 0); Vector3 head2(m_cellSize - delta, -smallDelta, 0); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index a9cc0dfd1ba..09a5fb0a02d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -69,23 +69,23 @@ MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParen { - //{{AFX_DATA_INIT(MapObjectProps) + //{{AFX_DATA_INIT(MapObjectProps) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } MapObjectProps::~MapObjectProps() { - if (TheMapObjectProps == this) + if (TheMapObjectProps == this) TheMapObjectProps = nullptr; - if ( m_posUndoable != nullptr ) - { - REF_PTR_RELEASE( m_posUndoable ); - } + if ( m_posUndoable != nullptr ) + { + REF_PTR_RELEASE( m_posUndoable ); + } - if ( m_hWnd ) - DestroyWindow(); + if ( m_hWnd ) + DestroyWindow(); } void MapObjectProps::DoDataExchange(CDataExchange* pDX) @@ -148,36 +148,36 @@ END_MESSAGE_MAP() static AsciiString getNthKeyStr(const Dict* d, int i) { - NameKeyType k = d->getNthKey(i); - AsciiString kstr = TheNameKeyGenerator->keyToName(k); - return kstr; + NameKeyType k = d->getNthKey(i); + AsciiString kstr = TheNameKeyGenerator->keyToName(k); + return kstr; } static AsciiString getNthValueStr(const Dict* d, int i, Bool* enquote) { - *enquote = false; - AsciiString vstr; - switch(d->getNthType(i)) - { + *enquote = false; + AsciiString vstr; + switch(d->getNthType(i)) + { case Dict::DICT_BOOL: - vstr.format("%s", d->getNthBool(i) ? "true" : "false"); - break; - case Dict::DICT_INT: - vstr.format("%d", d->getNthInt(i), d->getNthInt(i)); - break; - case Dict::DICT_REAL: - vstr.format("%f", d->getNthReal(i)); - break; - case Dict::DICT_ASCIISTRING: - vstr.format("%s", d->getNthAsciiString(i).str()); - *enquote = true; - break; - case Dict::DICT_UNICODESTRING: - vstr.format("%ls", d->getNthUnicodeString(i).str()); - *enquote = true; - break; - } - return vstr; + vstr.format("%s", d->getNthBool(i) ? "true" : "false"); + break; + case Dict::DICT_INT: + vstr.format("%d", d->getNthInt(i), d->getNthInt(i)); + break; + case Dict::DICT_REAL: + vstr.format("%f", d->getNthReal(i)); + break; + case Dict::DICT_ASCIISTRING: + vstr.format("%s", d->getNthAsciiString(i).str()); + *enquote = true; + break; + case Dict::DICT_UNICODESTRING: + vstr.format("%ls", d->getNthUnicodeString(i).str()); + *enquote = true; + break; + } + return vstr; } int MapObjectProps::getSel() @@ -192,136 +192,136 @@ int MapObjectProps::getSel() /// Move data from object to dialog controls void MapObjectProps::_DictToTeam(void) { - int i; - - AsciiString name; - CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Team); - owner->ResetContent(); - for (i = 0; i < TheSidesList->getNumTeams(); i++) - { - name = TheSidesList->getTeamInfo(i)->getDict()->getAsciiString(TheKey_teamName); - if (name == NEUTRAL_TEAM_INTERNAL_STR) - name = NEUTRAL_TEAM_UI_STR; - owner->AddString(name.str()); - } - // re-find, since the list is sorted - i = -1; - if (m_dictToEdit) - { - name = m_dictToEdit->getAsciiString(TheKey_originalOwner); - if (name == NEUTRAL_TEAM_INTERNAL_STR) - name = NEUTRAL_TEAM_UI_STR; - i = owner->FindStringExact(-1, name.str()); + int i; + + AsciiString name; + CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Team); + owner->ResetContent(); + for (i = 0; i < TheSidesList->getNumTeams(); i++) + { + name = TheSidesList->getTeamInfo(i)->getDict()->getAsciiString(TheKey_teamName); + if (name == NEUTRAL_TEAM_INTERNAL_STR) + name = NEUTRAL_TEAM_UI_STR; + owner->AddString(name.str()); + } + // re-find, since the list is sorted + i = -1; + if (m_dictToEdit) + { + name = m_dictToEdit->getAsciiString(TheKey_originalOwner); + if (name == NEUTRAL_TEAM_INTERNAL_STR) + name = NEUTRAL_TEAM_UI_STR; + i = owner->FindStringExact(-1, name.str()); DEBUG_ASSERTLOG(i >= 0, ("missing team '%s'. Non-fatal (jkmcd)", name.str())); - } - owner->SetCurSel(i); + } + owner->SetCurSel(i); } /// Move data from object to dialog controls void MapObjectProps::_DictToName(void) { - AsciiString name; - Bool exists; - if (m_dictToEdit) - { - name = m_dictToEdit->getAsciiString(TheKey_objectName, &exists); - } + AsciiString name; + Bool exists; + if (m_dictToEdit) + { + name = m_dictToEdit->getAsciiString(TheKey_objectName, &exists); + } - CWnd* pItem = GetDlgItem(IDC_MAPOBJECT_Name); - if (pItem) - { - pItem->SetWindowText(name.str()); - } + CWnd* pItem = GetDlgItem(IDC_MAPOBJECT_Name); + if (pItem) + { + pItem->SetWindowText(name.str()); + } } /// Move data from object to dialog controls void MapObjectProps::_DictToScript(void) { - if (!m_dictToEdit) - { - return; - } + if (!m_dictToEdit) + { + return; + } - Bool exists; - CComboBox *pCombo = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Script); - // Load the subroutine scripts into the combo box. - EditParameter::loadScripts(pCombo, true); + Bool exists; + CComboBox *pCombo = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Script); + // Load the subroutine scripts into the combo box. + EditParameter::loadScripts(pCombo, true); /*Int stringNdx =*/ pCombo->AddString(""); - AsciiString script = m_dictToEdit->getAsciiString(TheKey_objectScriptAttachment, &exists); + AsciiString script = m_dictToEdit->getAsciiString(TheKey_objectScriptAttachment, &exists); - if (script.isEmpty()) { - pCombo->SelectString(-1, ""); - } else { - pCombo->SelectString(-1, script.str()); - } + if (script.isEmpty()) { + pCombo->SelectString(-1, ""); + } else { + pCombo->SelectString(-1, script.str()); + } } /// Move data from dialog controls to object void MapObjectProps::_TeamToDict(void) { - getAllSelectedDicts(); + getAllSelectedDicts(); - CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Team); - static char buf[1024]; - owner->GetWindowText(buf, sizeof(buf)-2); - if (strcmp(buf, NEUTRAL_TEAM_UI_STR)==0) - strlcpy(buf, NEUTRAL_TEAM_INTERNAL_STR, ARRAY_SIZE(buf)); + CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Team); + static char buf[1024]; + owner->GetWindowText(buf, sizeof(buf)-2); + if (strcmp(buf, NEUTRAL_TEAM_UI_STR)==0) + strlcpy(buf, NEUTRAL_TEAM_INTERNAL_STR, ARRAY_SIZE(buf)); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - newDict.setAsciiString(TheKey_originalOwner, AsciiString(buf)); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + newDict.setAsciiString(TheKey_originalOwner, AsciiString(buf)); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object void MapObjectProps::_NameToDict(void) { - getAllSelectedDicts(); + getAllSelectedDicts(); - CWnd *owner = GetDlgItem(IDC_MAPOBJECT_Name); - CString cstr; - owner->GetWindowText(cstr); + CWnd *owner = GetDlgItem(IDC_MAPOBJECT_Name); + CString cstr; + owner->GetWindowText(cstr); - // Note: when starting up, this is called before a document exists. Just ignore such - // calls, since there can't be an object to affect. - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - newDict.setAsciiString(TheKey_objectName, cstr.GetBuffer(0)); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + // Note: when starting up, this is called before a document exists. Just ignore such + // calls, since there can't be an object to affect. + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + newDict.setAsciiString(TheKey_objectName, cstr.GetBuffer(0)); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object void MapObjectProps::_ScriptToDict(void) { - getAllSelectedDicts(); + getAllSelectedDicts(); - CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Script); - static char buf[1024]; - owner->GetWindowText(buf, sizeof(buf)-2); + CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Script); + static char buf[1024]; + owner->GetWindowText(buf, sizeof(buf)-2); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - newDict.setAsciiString(TheKey_objectScriptAttachment, AsciiString(buf)); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + newDict.setAsciiString(TheKey_objectScriptAttachment, AsciiString(buf)); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } @@ -330,33 +330,33 @@ void MapObjectProps::_DictToScale(void) { // Currently not in the Mission Disk. #if 0 - m_scale = 1; - Bool exists; - if (m_dictToEdit) { - m_scale = m_dictToEdit->getReal(TheKey_objectPrototypeScale, &exists); - } - if (!exists) { - m_scale = 1; - } - - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Scale); - CString cstr; - cstr.Format("%.2f", m_scale); - edit->SetWindowText(cstr); - - CButton *off = (CButton*) GetDlgItem(IDC_SCALE_OFF); - CButton *on = (CButton*) GetDlgItem(IDC_SCALE_ON); - if (!exists) { - off->SetCheck(1); - on->SetCheck(0); - edit->EnableWindow(false); - GetDlgItem(IDC_SCALE_POPUP)->EnableWindow(false); - } else { - off->SetCheck(0); - on->SetCheck(1); - edit->EnableWindow(TRUE); - GetDlgItem(IDC_SCALE_POPUP)->EnableWindow(true); - } + m_scale = 1; + Bool exists; + if (m_dictToEdit) { + m_scale = m_dictToEdit->getReal(TheKey_objectPrototypeScale, &exists); + } + if (!exists) { + m_scale = 1; + } + + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Scale); + CString cstr; + cstr.Format("%.2f", m_scale); + edit->SetWindowText(cstr); + + CButton *off = (CButton*) GetDlgItem(IDC_SCALE_OFF); + CButton *on = (CButton*) GetDlgItem(IDC_SCALE_ON); + if (!exists) { + off->SetCheck(1); + on->SetCheck(0); + edit->EnableWindow(false); + GetDlgItem(IDC_SCALE_POPUP)->EnableWindow(false); + } else { + off->SetCheck(0); + on->SetCheck(1); + edit->EnableWindow(TRUE); + GetDlgItem(IDC_SCALE_POPUP)->EnableWindow(true); + } #endif } @@ -364,73 +364,73 @@ void MapObjectProps::_DictToScale(void) /// Move data from object to dialog controls void MapObjectProps::_DictToWeather(void) { - Int value = 0; - Bool exists; - if (m_dictToEdit) { - value = m_dictToEdit->getInt(TheKey_objectWeather, &exists); - if (!exists) - value = 0; - } + Int value = 0; + Bool exists; + if (m_dictToEdit) { + value = m_dictToEdit->getInt(TheKey_objectWeather, &exists); + if (!exists) + value = 0; + } - CComboBox* pItem = (CComboBox*) GetDlgItem(IDC_MAPOBJECT_Weather); - pItem->SetCurSel(value); + CComboBox* pItem = (CComboBox*) GetDlgItem(IDC_MAPOBJECT_Weather); + pItem->SetCurSel(value); } /// Move data from object to dialog controls void MapObjectProps::_DictToTime(void) { - Int value = 0; - Bool exists; - if (m_dictToEdit) { - value = m_dictToEdit->getInt(TheKey_objectTime, &exists); - if (!exists) - value = 0; - } + Int value = 0; + Bool exists; + if (m_dictToEdit) { + value = m_dictToEdit->getInt(TheKey_objectTime, &exists); + if (!exists) + value = 0; + } - CComboBox* pItem = (CComboBox*) GetDlgItem(IDC_MAPOBJECT_Time); - pItem->SetCurSel(value); + CComboBox* pItem = (CComboBox*) GetDlgItem(IDC_MAPOBJECT_Time); + pItem->SetCurSel(value); } /// Move data from dialog controls to object void MapObjectProps::_WeatherToDict(void) { - getAllSelectedDicts(); + getAllSelectedDicts(); - CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Weather); - static char buf[1024]; - int curSel = owner->GetCurSel(); + CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Weather); + static char buf[1024]; + int curSel = owner->GetCurSel(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - newDict.setInt(TheKey_objectWeather, curSel); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + newDict.setInt(TheKey_objectWeather, curSel); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object void MapObjectProps::_TimeToDict(void) { - getAllSelectedDicts(); + getAllSelectedDicts(); - CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Time); - static char buf[1024]; - int curSel = owner->GetCurSel(); + CComboBox *owner = (CComboBox*)GetDlgItem(IDC_MAPOBJECT_Time); + static char buf[1024]; + int curSel = owner->GetCurSel(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - newDict.setInt(TheKey_objectTime, curSel); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + newDict.setInt(TheKey_objectTime, curSel); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object @@ -438,142 +438,142 @@ void MapObjectProps::_ScaleToDict(void) { // Currently not in mission disk. #if 0 - getAllSelectedDicts(); - - Real value = 0.0f; - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Scale); - CString cstr; - edit->GetWindowText(cstr); - if (!cstr.IsEmpty()) { - value = atof(cstr); - } - m_scale = value; - - CButton *off = (CButton*) GetDlgItem(IDC_SCALE_OFF); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - Dict newDict; - if (off->GetCheck() == 1) { - newDict.remove(TheKey_objectPrototypeScale); - } else { - newDict.setReal(TheKey_objectPrototypeScale, m_scale); - } - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + getAllSelectedDicts(); + + Real value = 0.0f; + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Scale); + CString cstr; + edit->GetWindowText(cstr); + if (!cstr.IsEmpty()) { + value = atof(cstr); + } + m_scale = value; + + CButton *off = (CButton*) GetDlgItem(IDC_SCALE_OFF); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + Dict newDict; + if (off->GetCheck() == 1) { + newDict.remove(TheKey_objectPrototypeScale); + } else { + newDict.setReal(TheKey_objectPrototypeScale, m_scale); + } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } #endif } /// Move data from object to dialog controls void MapObjectProps::ShowZOffset(MapObject *pMapObj) { - const Coord3D *loc = pMapObj->getLocation(); - static char buff[32]; - m_height = loc->z; - snprintf(buff, ARRAY_SIZE(buff), "%0.2f", loc->z); - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_ZOffset); - edit->SetWindowText(buff); + const Coord3D *loc = pMapObj->getLocation(); + static char buff[32]; + m_height = loc->z; + snprintf(buff, ARRAY_SIZE(buff), "%0.2f", loc->z); + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_ZOffset); + edit->SetWindowText(buff); } /// Move data from dialog controls to object void MapObjectProps::SetZOffset(void) { - Real value = 0.0f; - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_ZOffset); - CString cstr; - edit->GetWindowText(cstr); - if (!cstr.IsEmpty()) { - value = atof(cstr); - } - m_height = value; - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); - pDoc->AddAndDoUndoable(pUndo); - pUndo->SetZOffset(value); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - } + Real value = 0.0f; + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_ZOffset); + CString cstr; + edit->GetWindowText(cstr); + if (!cstr.IsEmpty()) { + value = atof(cstr); + } + m_height = value; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); + pDoc->AddAndDoUndoable(pUndo); + pUndo->SetZOffset(value); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + } } /// Move data from object to dialog controls void MapObjectProps::ShowAngle(MapObject *pMapObj) { - m_angle = pMapObj->getAngle() * 180 / PI; - static char buff[32]; - snprintf(buff, ARRAY_SIZE(buff), "%0.2f", m_angle); - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Angle); - edit->SetWindowText(buff); - m_angle = atof(buff); + m_angle = pMapObj->getAngle() * 180 / PI; + static char buff[32]; + snprintf(buff, ARRAY_SIZE(buff), "%0.2f", m_angle); + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Angle); + edit->SetWindowText(buff); + m_angle = atof(buff); } /// Move data from object to dialog controls void MapObjectProps::ShowPosition(MapObject *pMapObj) { - m_position = *pMapObj->getLocation(); - static char buff[64]; - snprintf(buff, ARRAY_SIZE(buff), "%0.2f, %0.2f", m_position.x, m_position.y); - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_XYPosition); - edit->SetWindowText(buff); - sscanf(buff, "%f,%f", &m_position.x, &m_position.y); + m_position = *pMapObj->getLocation(); + static char buff[64]; + snprintf(buff, ARRAY_SIZE(buff), "%0.2f, %0.2f", m_position.x, m_position.y); + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_XYPosition); + edit->SetWindowText(buff); + sscanf(buff, "%f,%f", &m_position.x, &m_position.y); } /// Move data from dialog controls to object void MapObjectProps::SetAngle(void) { - Real angle = m_angle; - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Angle); - CString cstr; - edit->GetWindowText(cstr); - if (!cstr.IsEmpty()) { - angle = atof(cstr); - } - if (m_selectedObject==nullptr) return; - if (m_angle!=angle) - { - m_angle = angle; - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); - pDoc->AddAndDoUndoable(pUndo); - pUndo->RotateTo(angle * PI/180); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - } - } + Real angle = m_angle; + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_Angle); + CString cstr; + edit->GetWindowText(cstr); + if (!cstr.IsEmpty()) { + angle = atof(cstr); + } + if (m_selectedObject==nullptr) return; + if (m_angle!=angle) + { + m_angle = angle; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); + pDoc->AddAndDoUndoable(pUndo); + pUndo->RotateTo(angle * PI/180); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + } + } } /// Move data from dialog controls to object void MapObjectProps::SetPosition(void) { - CWnd* edit = GetDlgItem(IDC_MAPOBJECT_XYPosition); - CString cstr; - edit->GetWindowText(cstr); - Coord3D loc; - loc = m_position; - if (m_selectedObject==nullptr) return; - if (!cstr.IsEmpty()) { - if (sscanf(cstr, "%f, %f", &loc.x, &loc.y)!=2) - loc = m_position; - } - if (loc.x!=m_position.x || loc.y != m_position.y) { - m_position = loc; - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc ) - { - ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); - pDoc->AddAndDoUndoable(pUndo); - if (m_selectedObject) { - loc = *m_selectedObject->getLocation(); - } - pUndo->SetOffset(m_position.x-loc.x, m_position.y-loc.y); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - } - } + CWnd* edit = GetDlgItem(IDC_MAPOBJECT_XYPosition); + CString cstr; + edit->GetWindowText(cstr); + Coord3D loc; + loc = m_position; + if (m_selectedObject==nullptr) return; + if (!cstr.IsEmpty()) { + if (sscanf(cstr, "%f, %f", &loc.x, &loc.y)!=2) + loc = m_position; + } + if (loc.x!=m_position.x || loc.y != m_position.y) { + m_position = loc; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc ) + { + ModifyObjectUndoable *pUndo = new ModifyObjectUndoable(pDoc); + pDoc->AddAndDoUndoable(pUndo); + if (m_selectedObject) { + loc = *m_selectedObject->getLocation(); + } + pUndo->SetOffset(m_position.x-loc.x, m_position.y-loc.y); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + } + } } /// Slider control @@ -613,8 +613,8 @@ void MapObjectProps::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa void MapObjectProps::PopSliderChanged(const long sliderID, long theVal) { CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc == nullptr ) - return; + if ( pDoc == nullptr ) + return; CWnd* edit; static char buff[32]; @@ -663,10 +663,10 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) switch (sliderID) { case IDC_HEIGHT_POPUP: case IDC_ANGLE_POPUP: - if ( m_posUndoable != nullptr ) - { - REF_PTR_RELEASE(m_posUndoable); // belongs to pDoc now. - } + if ( m_posUndoable != nullptr ) + { + REF_PTR_RELEASE(m_posUndoable); // belongs to pDoc now. + } m_posUndoable = nullptr; break; @@ -685,169 +685,169 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) /// Move data from dialog controls to object void MapObjectProps::_PrebuiltUpgradesToDict(void) { - getAllSelectedDicts(); - - CListBox *pBox = (CListBox *) GetDlgItem(IDC_MAPOBJECT_BuildWithUpgrades); - if (!pBox) { - return; - } - - // We only work for single selections - if (m_allSelectedDicts.size() != 1) { - return; - } - - if (m_selectedObject) { - if ( !m_selectedObject->getThingTemplate() ) { - return; - } - } - - Bool exists; - int upgradeNum = 0; - AsciiString upgradeString; - - // We're going to sub this entire dict for the existing entire dict. - Dict newDict = *m_allSelectedDicts[0]; - - // First, clear out any existing notions of what we should upgrade. - do { - AsciiString keyName; - keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = newDict.getAsciiString(NAMEKEY(keyName), &exists); - - if (exists) { - newDict.remove(NAMEKEY(keyName)); - } - - ++upgradeNum; - } while (!upgradeString.isEmpty()); - - upgradeNum = 0; - // We've now removed them, so lets add the ones that are selected now. - Int countOfItems = pBox->GetCount(); - for (Int i = 0; i < countOfItems; ++i) { - if (pBox->GetSel(i) > 0) { - CString selTxt; - // This thing is selected. Get its text, and add it to the dict. - pBox->GetText(i, selTxt); - - AsciiString keyName; - keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - newDict.setAsciiString(NAMEKEY(keyName), AsciiString(selTxt.GetBuffer(0))); - ++upgradeNum; - } - } - - // Now, do the Undoable - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, NAMEKEY_INVALID, m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - } + getAllSelectedDicts(); + + CListBox *pBox = (CListBox *) GetDlgItem(IDC_MAPOBJECT_BuildWithUpgrades); + if (!pBox) { + return; + } + + // We only work for single selections + if (m_allSelectedDicts.size() != 1) { + return; + } + + if (m_selectedObject) { + if ( !m_selectedObject->getThingTemplate() ) { + return; + } + } + + Bool exists; + int upgradeNum = 0; + AsciiString upgradeString; + + // We're going to sub this entire dict for the existing entire dict. + Dict newDict = *m_allSelectedDicts[0]; + + // First, clear out any existing notions of what we should upgrade. + do { + AsciiString keyName; + keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); + upgradeString = newDict.getAsciiString(NAMEKEY(keyName), &exists); + + if (exists) { + newDict.remove(NAMEKEY(keyName)); + } + + ++upgradeNum; + } while (!upgradeString.isEmpty()); + + upgradeNum = 0; + // We've now removed them, so lets add the ones that are selected now. + Int countOfItems = pBox->GetCount(); + for (Int i = 0; i < countOfItems; ++i) { + if (pBox->GetSel(i) > 0) { + CString selTxt; + // This thing is selected. Get its text, and add it to the dict. + pBox->GetText(i, selTxt); + + AsciiString keyName; + keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); + newDict.setAsciiString(NAMEKEY(keyName), AsciiString(selTxt.GetBuffer(0))); + ++upgradeNum; + } + } + + // Now, do the Undoable + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, NAMEKEY_INVALID, m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + } } /// Move data from object to dialog controls void MapObjectProps::_DictToPrebuiltUpgrades(void) { - getAllSelectedDicts(); - - CListBox *pBox = (CListBox*) GetDlgItem(IDC_MAPOBJECT_BuildWithUpgrades); - if (!pBox) { - return; - } - - // First, clear out the list - pBox->ResetContent(); - CString cstr; - - // Then, if there's multiple units selected, add the Single Selection Only string - if (m_allSelectedDicts.size() > 1) { - cstr.LoadString(IDS_SINGLE_SELECTION_ONLY); - pBox->AddString(cstr); - return; - } - - if (m_selectedObject == nullptr) { - return; - } - - // Otherwise, fill it with the upgrades available for this unit - const ThingTemplate *tt = m_selectedObject->getThingTemplate(); - if (tt == nullptr) { - // This is valid. For instance, Scorch marks do not have thing templates. - return; - } - - Bool noUpgrades = false; - - // Now do any behaviors that are also upgrades. - const ModuleInfo& mi = tt->getBehaviorModuleInfo(); - if (mi.getCount() == 0) { - if (noUpgrades) { - cstr.LoadString(IDS_NO_UPGRADES); - pBox->AddString(cstr); - return; - } - } else { - Int numBehaviorModules = mi.getCount(); - - Int numBehaviorsWithUpgrades = 0; - - for (int i = 0; i < numBehaviorModules; ++i) { - if (mi.getNthName(i).compareNoCase("GenerateMinefieldBehavior") == 0) { - const GenerateMinefieldBehaviorModuleData *gmbmd = (const GenerateMinefieldBehaviorModuleData *)mi.getNthData(i); - if (!gmbmd) { - continue; - } - if (!gmbmd->m_upgradeMuxData.m_activationUpgradeNames.empty()) { - cstr = gmbmd->m_upgradeMuxData.m_activationUpgradeNames[0].str(); - if (pBox->FindString(-1, cstr) == LB_ERR) { - pBox->AddString(cstr); - ++numBehaviorsWithUpgrades; - } - } - } - } - - if (numBehaviorsWithUpgrades == 0) { - if (noUpgrades) { - cstr.LoadString(IDS_NO_UPGRADES); - pBox->AddString(cstr); - return; - } - } - } - - // Finally, walk through the upgrades that he already has, and select the appropriate members - // from the list - - Bool exists; - int upgradeNum = 0; - AsciiString upgradeString; - - do { - AsciiString keyName; - keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); - upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName), &exists); - - if (exists) { - Int selNdx = pBox->FindStringExact(-1, upgradeString.str()); - if (selNdx == LB_ERR) { - DEBUG_CRASH(("Object claims '%s', but it wasn't found in the list of possible upgrades.", upgradeString.str())); - ++upgradeNum; - continue; - } - pBox->SetSel(selNdx); - - } else { - upgradeString.clear(); - } - - ++upgradeNum; - } while (!upgradeString.isEmpty()); + getAllSelectedDicts(); + + CListBox *pBox = (CListBox*) GetDlgItem(IDC_MAPOBJECT_BuildWithUpgrades); + if (!pBox) { + return; + } + + // First, clear out the list + pBox->ResetContent(); + CString cstr; + + // Then, if there's multiple units selected, add the Single Selection Only string + if (m_allSelectedDicts.size() > 1) { + cstr.LoadString(IDS_SINGLE_SELECTION_ONLY); + pBox->AddString(cstr); + return; + } + + if (m_selectedObject == nullptr) { + return; + } + + // Otherwise, fill it with the upgrades available for this unit + const ThingTemplate *tt = m_selectedObject->getThingTemplate(); + if (tt == nullptr) { + // This is valid. For instance, Scorch marks do not have thing templates. + return; + } + + Bool noUpgrades = false; + + // Now do any behaviors that are also upgrades. + const ModuleInfo& mi = tt->getBehaviorModuleInfo(); + if (mi.getCount() == 0) { + if (noUpgrades) { + cstr.LoadString(IDS_NO_UPGRADES); + pBox->AddString(cstr); + return; + } + } else { + Int numBehaviorModules = mi.getCount(); + + Int numBehaviorsWithUpgrades = 0; + + for (int i = 0; i < numBehaviorModules; ++i) { + if (mi.getNthName(i).compareNoCase("GenerateMinefieldBehavior") == 0) { + const GenerateMinefieldBehaviorModuleData *gmbmd = (const GenerateMinefieldBehaviorModuleData *)mi.getNthData(i); + if (!gmbmd) { + continue; + } + if (!gmbmd->m_upgradeMuxData.m_activationUpgradeNames.empty()) { + cstr = gmbmd->m_upgradeMuxData.m_activationUpgradeNames[0].str(); + if (pBox->FindString(-1, cstr) == LB_ERR) { + pBox->AddString(cstr); + ++numBehaviorsWithUpgrades; + } + } + } + } + + if (numBehaviorsWithUpgrades == 0) { + if (noUpgrades) { + cstr.LoadString(IDS_NO_UPGRADES); + pBox->AddString(cstr); + return; + } + } + } + + // Finally, walk through the upgrades that he already has, and select the appropriate members + // from the list + + Bool exists; + int upgradeNum = 0; + AsciiString upgradeString; + + do { + AsciiString keyName; + keyName.format("%s%d", TheNameKeyGenerator->keyToName(TheKey_objectGrantUpgrade).str(), upgradeNum); + upgradeString = m_dictToEdit->getAsciiString(NAMEKEY(keyName), &exists); + + if (exists) { + Int selNdx = pBox->FindStringExact(-1, upgradeString.str()); + if (selNdx == LB_ERR) { + DEBUG_CRASH(("Object claims '%s', but it wasn't found in the list of possible upgrades.", upgradeString.str())); + ++upgradeNum; + continue; + } + pBox->SetSel(selNdx); + + } else { + upgradeString.clear(); + } + + ++upgradeNum; + } while (!upgradeString.isEmpty()); } /// Move data from object to dialog controls @@ -1083,14 +1083,14 @@ void MapObjectProps::_DictToShroudClearingDistance(void) /// Move data from object to dialog controls void MapObjectProps::_DictToRecruitableAI(void) { - Bool recruitableAI = true; - Bool exists; - if (m_dictToEdit) { + Bool recruitableAI = true; + Bool exists; + if (m_dictToEdit) { recruitableAI = m_dictToEdit->getBool(TheKey_objectRecruitableAI, &exists); - } + } - CButton* pItem = (CButton*) GetDlgItem(IDC_MAPOBJECT_RecruitableAI); - if (pItem) { + CButton* pItem = (CButton*) GetDlgItem(IDC_MAPOBJECT_RecruitableAI); + if (pItem) { pItem->SetCheck(recruitableAI); } } @@ -1162,15 +1162,15 @@ void MapObjectProps::_HealthToDict(void) value = atoi(cstr.GetBuffer(0)); } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setInt(TheKey_objectInitialHealth, value); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } @@ -1183,15 +1183,15 @@ void MapObjectProps::_EnabledToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool(TheKey_objectEnabled, isChecked); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1203,15 +1203,15 @@ void MapObjectProps::_IndestructibleToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool(TheKey_objectIndestructible, isChecked); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1223,15 +1223,15 @@ void MapObjectProps::_UnsellableToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool(TheKey_objectUnsellable, isChecked); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1243,15 +1243,15 @@ void MapObjectProps::_TargetableToDict() Bool isChecked = owner->GetCheck() != 0; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool( TheKey_objectTargetable, isChecked ); DictItemUndoable *pUndo = new DictItemUndoable( getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size() ); pDoc->AddAndDoUndoable( pUndo ); REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. // Update is called by Do - } + } } @@ -1264,15 +1264,15 @@ void MapObjectProps::_PoweredToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool(TheKey_objectPowered, isChecked); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1298,15 +1298,15 @@ void MapObjectProps::_AggressivenessToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setInt(TheKey_objectAggressiveness, value); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1324,8 +1324,8 @@ void MapObjectProps::_VisibilityToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; if (value != -1) { newDict.setInt(TheKey_objectVisualRange, value); @@ -1334,7 +1334,7 @@ void MapObjectProps::_VisibilityToDict(void) pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1351,15 +1351,15 @@ void MapObjectProps::_VeterancyToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setInt(TheKey_objectVeterancy, value); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1377,8 +1377,8 @@ void MapObjectProps::_ShroudClearingDistanceToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; if (value != -1) { newDict.setInt(TheKey_objectShroudClearingDistance, value); @@ -1387,7 +1387,7 @@ void MapObjectProps::_ShroudClearingDistanceToDict(void) pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1399,15 +1399,15 @@ void MapObjectProps::_RecruitableAIToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setBool(TheKey_objectRecruitableAI, isChecked); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1420,8 +1420,8 @@ void MapObjectProps::_SelectableToDict(void) Bool isTristate = (owner->GetCheck() == 2); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; if (isTristate) { newDict.remove(TheKey_objectSelectable); @@ -1432,7 +1432,7 @@ void MapObjectProps::_SelectableToDict(void) pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Do - } + } } /// Move data from dialog controls to object @@ -1450,15 +1450,15 @@ void MapObjectProps::_HPsToDict() value = -1; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + if ( pDoc != nullptr ) + { + Dict newDict; newDict.setInt(TheKey_objectMaxHPs, value); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - } + } } /// Move data from dialog controls to object @@ -1478,15 +1478,15 @@ void MapObjectProps::_StoppingDistanceToDict(void) value = atof(cstr.GetBuffer(0)); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { + if ( pDoc != nullptr ) + { Dict newDict; newDict.setReal(TheKey_objectStoppingDistance, value); DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. // Update is called by Doc - } + } } @@ -1598,9 +1598,9 @@ BOOL MapObjectProps::OnInitDialog() if (m_title) SetWindowText(m_title); - m_heightSlider.SetupPopSliderButton(this, IDC_HEIGHT_POPUP, this); - m_angleSlider.SetupPopSliderButton(this, IDC_ANGLE_POPUP, this); - m_scaleSlider.SetupPopSliderButton(this, IDC_SCALE_POPUP, this); + m_heightSlider.SetupPopSliderButton(this, IDC_HEIGHT_POPUP, this); + m_angleSlider.SetupPopSliderButton(this, IDC_ANGLE_POPUP, this); + m_scaleSlider.SetupPopSliderButton(this, IDC_SCALE_POPUP, this); m_posUndoable = nullptr; m_angle = 0; m_height = 0; @@ -1609,7 +1609,7 @@ BOOL MapObjectProps::OnInitDialog() InitSound(); updateTheUI(); - return TRUE; + return TRUE; } //--------------------------------------------------------------------------------------------------- @@ -1631,8 +1631,8 @@ void MapObjectProps::updateTheUI(void) continue; } - m_dictSource = pMapObj; - // Select correct dictionary + m_dictSource = pMapObj; + // Select correct dictionary m_dictToEdit = m_dictSource ? m_dictSource->getProperties() : nullptr; updateTheUI(m_dictSource); @@ -1645,93 +1645,93 @@ void MapObjectProps::updateTheUI(void) /// Move *all* data from object to dialog controls void MapObjectProps::updateTheUI(MapObject *pMapObj) { - _DictToName(); - _DictToTeam(); - _DictToScript(); - _DictToWeather(); - _DictToTime(); - _DictToScale(); - _DictToPrebuiltUpgrades(); + _DictToName(); + _DictToTeam(); + _DictToScript(); + _DictToWeather(); + _DictToTime(); + _DictToScale(); + _DictToPrebuiltUpgrades(); _DictToHealth(); - _DictToHPs(); - _DictToEnabled(); - _DictToDestructible(); - _DictToPowered(); - _DictToAggressiveness(); - _DictToVisibilityRange(); - _DictToVeterancy(); - _DictToShroudClearingDistance(); - _DictToRecruitableAI(); - _DictToSelectable(); - _DictToStoppingDistance(); - _DictToUnsellable(); - _DictToTargetable(); + _DictToHPs(); + _DictToEnabled(); + _DictToDestructible(); + _DictToPowered(); + _DictToAggressiveness(); + _DictToVisibilityRange(); + _DictToVeterancy(); + _DictToShroudClearingDistance(); + _DictToRecruitableAI(); + _DictToSelectable(); + _DictToStoppingDistance(); + _DictToUnsellable(); + _DictToTargetable(); ShowZOffset(pMapObj); - ShowAngle(pMapObj); - ShowPosition(pMapObj); - - // Warning: order is important. dictToAttachedSound() must come before dictToCustomize(), - // dictToCustomize() must come before any of the customization controls, dictToLooping() - // must come before dictToLoopCount(), and dictToLooping() and dictToLoopCount() must - // come before dictToEnabled(). - dictToAttachedSound(); - dictToCustomize(); - dictToLooping(); - dictToLoopCount(); - dictToEnabled(); - dictToMinVolume(); - dictToVolume(); - dictToMinRange(); - dictToMaxRange(); - dictToPriority(); + ShowAngle(pMapObj); + ShowPosition(pMapObj); + + // Warning: order is important. dictToAttachedSound() must come before dictToCustomize(), + // dictToCustomize() must come before any of the customization controls, dictToLooping() + // must come before dictToLoopCount(), and dictToLooping() and dictToLoopCount() must + // come before dictToEnabled(). + dictToAttachedSound(); + dictToCustomize(); + dictToLooping(); + dictToLoopCount(); + dictToEnabled(); + dictToMinVolume(); + dictToVolume(); + dictToMinRange(); + dictToMaxRange(); + dictToPriority(); } //--------------------------------------------------------------------------------------------------- void MapObjectProps::InitSound(void) { - CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - DEBUG_ASSERTCRASH( priorityComboBox != nullptr, ("Cannot find sound priority combobox" ) ); + CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); + DEBUG_ASSERTCRASH( priorityComboBox != nullptr, ("Cannot find sound priority combobox" ) ); - if ( priorityComboBox != nullptr ) - { - Int i; - for ( i = 0; i <= AP_CRITICAL; i++ ) - { - Int index = priorityComboBox->InsertString( i,theAudioPriorityNames[i] ); - (void)index; - DEBUG_ASSERTCRASH( index == i, ("insert string returned %d, expected %d", index, i ) ); - } - } + if ( priorityComboBox != nullptr ) + { + Int i; + for ( i = 0; i <= AP_CRITICAL; i++ ) + { + Int index = priorityComboBox->InsertString( i,theAudioPriorityNames[i] ); + (void)index; + DEBUG_ASSERTCRASH( index == i, ("insert string returned %d, expected %d", index, i ) ); + } + } - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - DEBUG_ASSERTCRASH( soundComboBox != nullptr, ("Cannot find sound combobox" ) ); - m_defaultEntryIndex = 0; - m_defaultIsNone = true; + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + DEBUG_ASSERTCRASH( soundComboBox != nullptr, ("Cannot find sound combobox" ) ); + m_defaultEntryIndex = 0; + m_defaultIsNone = true; - // Load up combobox - if ( soundComboBox != nullptr ) - { - // Add all the sound names in order. Since the combobox has the SORTED style, - // we can just add the strings in and let the combo box sort them - const AudioEventInfoHash & audioEventHash = TheAudio->getAllAudioEvents(); + // Load up combobox + if ( soundComboBox != nullptr ) + { + // Add all the sound names in order. Since the combobox has the SORTED style, + // we can just add the strings in and let the combo box sort them + const AudioEventInfoHash & audioEventHash = TheAudio->getAllAudioEvents(); - AudioEventInfoHash::const_iterator it; - for ( it = audioEventHash.begin(); it != audioEventHash.end(); it++ ) - { - if ( it->second->m_soundType == AT_SoundEffect ) - { - // Hmm, should we be filtering the list in any other way? Oh well. - soundComboBox->AddString( it->second->m_audioName.str() ); - } - } + AudioEventInfoHash::const_iterator it; + for ( it = audioEventHash.begin(); it != audioEventHash.end(); it++ ) + { + if ( it->second->m_soundType == AT_SoundEffect ) + { + // Hmm, should we be filtering the list in any other way? Oh well. + soundComboBox->AddString( it->second->m_audioName.str() ); + } + } - m_defaultEntryIndex = soundComboBox->InsertString( 0, BASE_DEFAULT_STRING ); - m_defaultEntryName = NO_SOUND_STRING; - m_defaultIsNone = true; + m_defaultEntryIndex = soundComboBox->InsertString( 0, BASE_DEFAULT_STRING ); + m_defaultEntryName = NO_SOUND_STRING; + m_defaultIsNone = true; - soundComboBox->InsertString( 1, NO_SOUND_STRING ); - } + soundComboBox->InsertString( 1, NO_SOUND_STRING ); + } } @@ -1742,1043 +1742,1043 @@ void MapObjectProps::InitSound(void) // NOTE: assumes getAllSelectedDicts() has already been called void MapObjectProps::clearCustomizeFlag( CWorldBuilderDoc* pDoc, MultipleUndoable * ownerUndoable ) { - Dict empty; + Dict empty; - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - // Note: we can set all the undoes in between the first and last undo to not invalidate, - // since the first (last for doing) and last invalidate after these changes anyway - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMaxRange, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + // Note: we can set all the undoes in between the first and last undo to not invalidate, + // since the first (last for doing) and last invalidate after these changes anyway + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMaxRange, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMinVolume, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMinVolume, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientVolume, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientVolume, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMinRange, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientMinRange, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientLooping, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientLooping, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientLoopCount, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientLoopCount, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientPriority, m_allSelectedDicts.size(), pDoc, true); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(getAllSelectedDictsData(), empty, TheKey_objectSoundAmbientPriority, m_allSelectedDicts.size(), pDoc, true); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. } /// Move data from dialog controls to object(s) void MapObjectProps::attachedSoundToDict(void) { - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - MultipleUndoable *pUndo = new MultipleUndoable; - - Dict newDict; - - // For the default, erase the objectSoundAmbient key - if ( soundComboBox->GetCurSel() != m_defaultEntryIndex ) - { - CString selectionText; - soundComboBox->GetLBText( soundComboBox->GetCurSel(), selectionText ); - if ( selectionText == NO_SOUND_STRING ) - { - newDict.setAsciiString(TheKey_objectSoundAmbient, ""); - // Can't customize the null sound - clearCustomizeFlag( pDoc, pUndo ); - } - else - { - newDict.setAsciiString(TheKey_objectSoundAmbient, static_cast< const char * >( selectionText) ); - } - } - else if ( m_defaultIsNone ) - { - // Can't customize the null sound - clearCustomizeFlag( pDoc, pUndo ); - } - - DictItemUndoable *pDictUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, TheKey_objectSoundAmbient, m_allSelectedDicts.size(), pDoc, true); - pUndo->addUndoable( pDictUndo ); - pDoc->AddAndDoUndoable( pUndo ); - REF_PTR_RELEASE( pDictUndo ); // belongs to pUndo - REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. - // Update is called by Doc - } -} - -/// Move data from dialog controls to object(s) -void MapObjectProps::customizeToDict(void) -{ - CButton * customizeCheckbox = (CButton *)GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; - - // For space reasons, erase key instead of added "false" key. Should be treated the same - if ( customizeCheckbox->GetCheck() == 1 ) - { - newDict.setBool( TheKey_objectSoundAmbientCustomized, true ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } - else - { - MultipleUndoable *pUndo = new MultipleUndoable; - clearCustomizeFlag( pDoc, pUndo ); - pDoc->AddAndDoUndoable( pUndo ); - REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. - // Update is called by Doc - } - } -} + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + return; -/// Move data from dialog controls to object(s) -void MapObjectProps::enabledToDict(void) -{ - CButton * enabledCheckbox = (CButton *)GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enabledCheckbox == nullptr ) - return; + getAllSelectedDicts(); - getAllSelectedDicts(); + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + MultipleUndoable *pUndo = new MultipleUndoable; + + Dict newDict; + + // For the default, erase the objectSoundAmbient key + if ( soundComboBox->GetCurSel() != m_defaultEntryIndex ) + { + CString selectionText; + soundComboBox->GetLBText( soundComboBox->GetCurSel(), selectionText ); + if ( selectionText == NO_SOUND_STRING ) + { + newDict.setAsciiString(TheKey_objectSoundAmbient, ""); + // Can't customize the null sound + clearCustomizeFlag( pDoc, pUndo ); + } + else + { + newDict.setAsciiString(TheKey_objectSoundAmbient, static_cast< const char * >( selectionText) ); + } + } + else if ( m_defaultIsNone ) + { + // Can't customize the null sound + clearCustomizeFlag( pDoc, pUndo ); + } + + DictItemUndoable *pDictUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, TheKey_objectSoundAmbient, m_allSelectedDicts.size(), pDoc, true); + pUndo->addUndoable( pDictUndo ); + pDoc->AddAndDoUndoable( pUndo ); + REF_PTR_RELEASE( pDictUndo ); // belongs to pUndo + REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. + // Update is called by Doc + } +} + +/// Move data from dialog controls to object(s) +void MapObjectProps::customizeToDict(void) +{ + CButton * customizeCheckbox = (CButton *)GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + // For space reasons, erase key instead of added "false" key. Should be treated the same + if ( customizeCheckbox->GetCheck() == 1 ) + { + newDict.setBool( TheKey_objectSoundAmbientCustomized, true ); + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } + else + { + MultipleUndoable *pUndo = new MultipleUndoable; + clearCustomizeFlag( pDoc, pUndo ); + pDoc->AddAndDoUndoable( pUndo ); + REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. + // Update is called by Doc + } + } +} - newDict.setBool( TheKey_objectSoundAmbientEnabled, enabledCheckbox->GetCheck() != 0 ); +/// Move data from dialog controls to object(s) +void MapObjectProps::enabledToDict(void) +{ + CButton * enabledCheckbox = (CButton *)GetDlgItem(IDC_ENABLED_CHECKBOX); + if ( enabledCheckbox == nullptr ) + return; - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; + + newDict.setBool( TheKey_objectSoundAmbientEnabled, enabledCheckbox->GetCheck() != 0 ); + + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::loopingToDict(void) { - CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == nullptr ) - return; + CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( loopingCheckbox == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - newDict.setBool( TheKey_objectSoundAmbientLooping, loopingCheckbox->GetCheck() != 0 ); + newDict.setBool( TheKey_objectSoundAmbientLooping, loopingCheckbox->GetCheck() != 0 ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::loopCountToDict(void) { - CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == nullptr ) - return; + CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopCountEdit == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CString loopCountString; - loopCountEdit->GetWindowText(loopCountString); + CString loopCountString; + loopCountEdit->GetWindowText(loopCountString); - newDict.setInt( TheKey_objectSoundAmbientLoopCount, atoi( loopCountString ) ); + newDict.setInt( TheKey_objectSoundAmbientLoopCount, atoi( loopCountString ) ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::minVolumeToDict(void) { - CEdit * minVolumeEdit = (CEdit *)GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == nullptr ) - return; + CEdit * minVolumeEdit = (CEdit *)GetDlgItem(IDC_MIN_VOLUME_EDIT); + if ( minVolumeEdit == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CString minVolumeString; - minVolumeEdit->GetWindowText(minVolumeString); + CString minVolumeString; + minVolumeEdit->GetWindowText(minVolumeString); - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - newDict.setReal( TheKey_objectSoundAmbientMinVolume, INT_TO_REAL( atoi( minVolumeString ) ) / 100.0f ); + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + newDict.setReal( TheKey_objectSoundAmbientMinVolume, INT_TO_REAL( atoi( minVolumeString ) ) / 100.0f ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::volumeToDict(void) { - CEdit * volumeEdit = (CEdit *)GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == nullptr ) - return; + CEdit * volumeEdit = (CEdit *)GetDlgItem(IDC_VOLUME_EDIT); + if ( volumeEdit == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CString volumeString; - volumeEdit->GetWindowText(volumeString); + CString volumeString; + volumeEdit->GetWindowText(volumeString); - // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - newDict.setReal( TheKey_objectSoundAmbientVolume, INT_TO_REAL( atoi( volumeString ) ) / 100.0f ); + // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + newDict.setReal( TheKey_objectSoundAmbientVolume, INT_TO_REAL( atoi( volumeString ) ) / 100.0f ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::minRangeToDict(void) { - CEdit * minRangeEdit = (CEdit *)GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == nullptr ) - return; + CEdit * minRangeEdit = (CEdit *)GetDlgItem(IDC_MIN_RANGE_EDIT); + if ( minRangeEdit == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CString minRangeString; - minRangeEdit->GetWindowText(minRangeString); + CString minRangeString; + minRangeEdit->GetWindowText(minRangeString); - newDict.setReal( TheKey_objectSoundAmbientMinRange, INT_TO_REAL( atoi( minRangeString ) ) ); + newDict.setReal( TheKey_objectSoundAmbientMinRange, INT_TO_REAL( atoi( minRangeString ) ) ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::maxRangeToDict(void) { - CEdit * maxRangeEdit = (CEdit *)GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == nullptr ) - return; + CEdit * maxRangeEdit = (CEdit *)GetDlgItem(IDC_MAX_RANGE_EDIT); + if ( maxRangeEdit == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - CString maxRangeString; - maxRangeEdit->GetWindowText(maxRangeString); + CString maxRangeString; + maxRangeEdit->GetWindowText(maxRangeString); - newDict.setReal( TheKey_objectSoundAmbientMaxRange, INT_TO_REAL( atoi( maxRangeString ) ) ); + newDict.setReal( TheKey_objectSoundAmbientMaxRange, INT_TO_REAL( atoi( maxRangeString ) ) ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::priorityToDict(void) { - CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == nullptr ) - return; + CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); + if ( priorityComboBox == nullptr ) + return; - getAllSelectedDicts(); + getAllSelectedDicts(); - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != nullptr ) - { - Dict newDict; + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != nullptr ) + { + Dict newDict; - newDict.setInt( TheKey_objectSoundAmbientPriority, priorityComboBox->GetCurSel() ); + newDict.setInt( TheKey_objectSoundAmbientPriority, priorityComboBox->GetCurSel() ); - DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from object to dialog controls void MapObjectProps::dictToAttachedSound() { - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - return; - - // Update the string for the "default" entry - m_defaultIsNone = true; - m_defaultEntryName = NO_SOUND_STRING; - soundComboBox->DeleteString(m_defaultEntryIndex); - const ThingTemplate * thingTemplate = nullptr; - if (m_dictSource) - { - thingTemplate = m_dictSource->getThingTemplate(); - } - - if ( thingTemplate ) - { - AsciiString string( BASE_DEFAULT_STRING ); - - const AudioEventRTS * defaultAudioEvent; - - // Note: getSoundAmbient will return a non-null pointer even if there is no real sound attached to the object - if ( thingTemplate->hasSoundAmbient() ) - { - defaultAudioEvent = thingTemplate->getSoundAmbient(); - } - else - { - defaultAudioEvent = nullptr; - } - - if ( defaultAudioEvent == nullptr || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) - { - string.concat( " " ); - } - else - { - string.concat( " <" ); - string.concat( defaultAudioEvent->getEventName() ); - string.concat( '>' ); - m_defaultEntryName = defaultAudioEvent->getEventName(); - m_defaultIsNone = false; - } - m_defaultEntryIndex = soundComboBox->InsertString(0, string.str()); - } - else - { - m_defaultEntryIndex = soundComboBox->InsertString(0, BASE_DEFAULT_STRING); - } - - // Now select the correct entry in the list box - AsciiString sound; - Bool exists = false; - if (m_dictToEdit) - { - sound = m_dictToEdit->getAsciiString(TheKey_objectSoundAmbient, &exists); - } - - if ( !exists ) - { - // Use the "default" entry - soundComboBox->SetCurSel( m_defaultEntryIndex ); - return; - } - - if ( sound.isEmpty() ) - { - // Use the entry "(None)" - sound = NO_SOUND_STRING; - } - - // Note: better than SelectString because we want the exact string not a prefix - Int index = soundComboBox->FindStringExact( -1, sound.str() ); - if ( index > -1 ) - { - soundComboBox->SetCurSel( index ); - } - else - { - DEBUG_CRASH( ("Could not find existing sound's name %s in combo box", sound.str() ) ); - soundComboBox->SetCurSel( m_defaultEntryIndex ); - } + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + return; + + // Update the string for the "default" entry + m_defaultIsNone = true; + m_defaultEntryName = NO_SOUND_STRING; + soundComboBox->DeleteString(m_defaultEntryIndex); + const ThingTemplate * thingTemplate = nullptr; + if (m_dictSource) + { + thingTemplate = m_dictSource->getThingTemplate(); + } + + if ( thingTemplate ) + { + AsciiString string( BASE_DEFAULT_STRING ); + + const AudioEventRTS * defaultAudioEvent; + + // Note: getSoundAmbient will return a non-null pointer even if there is no real sound attached to the object + if ( thingTemplate->hasSoundAmbient() ) + { + defaultAudioEvent = thingTemplate->getSoundAmbient(); + } + else + { + defaultAudioEvent = nullptr; + } + + if ( defaultAudioEvent == nullptr || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) + { + string.concat( " " ); + } + else + { + string.concat( " <" ); + string.concat( defaultAudioEvent->getEventName() ); + string.concat( '>' ); + m_defaultEntryName = defaultAudioEvent->getEventName(); + m_defaultIsNone = false; + } + m_defaultEntryIndex = soundComboBox->InsertString(0, string.str()); + } + else + { + m_defaultEntryIndex = soundComboBox->InsertString(0, BASE_DEFAULT_STRING); + } + + // Now select the correct entry in the list box + AsciiString sound; + Bool exists = false; + if (m_dictToEdit) + { + sound = m_dictToEdit->getAsciiString(TheKey_objectSoundAmbient, &exists); + } + + if ( !exists ) + { + // Use the "default" entry + soundComboBox->SetCurSel( m_defaultEntryIndex ); + return; + } + + if ( sound.isEmpty() ) + { + // Use the entry "(None)" + sound = NO_SOUND_STRING; + } + + // Note: better than SelectString because we want the exact string not a prefix + Int index = soundComboBox->FindStringExact( -1, sound.str() ); + if ( index > -1 ) + { + soundComboBox->SetCurSel( index ); + } + else + { + DEBUG_CRASH( ("Could not find existing sound's name %s in combo box", sound.str() ) ); + soundComboBox->SetCurSel( m_defaultEntryIndex ); + } } /// Move data from object to dialog controls void MapObjectProps::dictToCustomize() { - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr ) - return; + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr ) + return; - // If the current sound is "none", disable the customize button - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - return; + // If the current sound is "none", disable the customize button + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + return; - int index = soundComboBox->GetCurSel(); - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || + int index = soundComboBox->GetCurSel(); + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - customizeCheckbox->SetCheck( 0 ); - customizeCheckbox->EnableWindow( false ); - return; - } + { + customizeCheckbox->SetCheck( 0 ); + customizeCheckbox->EnableWindow( false ); + return; + } - // Sound is not "none", so we can customize if we wish - customizeCheckbox->EnableWindow( true ); + // Sound is not "none", so we can customize if we wish + customizeCheckbox->EnableWindow( true ); - Bool exists = false; - Bool customized = false; - if (m_dictToEdit) - { - customized = m_dictToEdit->getBool(TheKey_objectSoundAmbientCustomized, &exists); - } + Bool exists = false; + Bool customized = false; + if (m_dictToEdit) + { + customized = m_dictToEdit->getBool(TheKey_objectSoundAmbientCustomized, &exists); + } - customizeCheckbox->SetCheck( exists && customized ? 1 : 0 ); + customizeCheckbox->SetCheck( exists && customized ? 1 : 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToLooping() { - CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - loopingCheckbox->EnableWindow( false ); - } - else - { - loopingCheckbox->EnableWindow( true ); - - // If customization is enabled, look to see if the looping flag has already been - // customized - Bool exists = false; - Bool looping = false; - if (m_dictToEdit) - { - looping = m_dictToEdit->getBool(TheKey_objectSoundAmbientLooping, &exists); - } - - if ( exists ) - { - loopingCheckbox->SetCheck( looping ? 1 : 0 ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the looping checkbox - - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - loopingCheckbox->SetCheck( 0 ); - return; - } - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - loopingCheckbox->SetCheck( 0 ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - loopingCheckbox->SetCheck( ( audioEventInfo && ( audioEventInfo->m_control & AC_LOOP ) ) ? 1 : 0 ); + CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( loopingCheckbox == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + loopingCheckbox->EnableWindow( false ); + } + else + { + loopingCheckbox->EnableWindow( true ); + + // If customization is enabled, look to see if the looping flag has already been + // customized + Bool exists = false; + Bool looping = false; + if (m_dictToEdit) + { + looping = m_dictToEdit->getBool(TheKey_objectSoundAmbientLooping, &exists); + } + + if ( exists ) + { + loopingCheckbox->SetCheck( looping ? 1 : 0 ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the looping checkbox + + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + loopingCheckbox->SetCheck( 0 ); + return; + } + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + loopingCheckbox->SetCheck( 0 ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + loopingCheckbox->SetCheck( ( audioEventInfo && ( audioEventInfo->m_control & AC_LOOP ) ) ? 1 : 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToLoopCount() { - CEdit * loopCountEdit = ( CEdit * )GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == nullptr ) - return; + CEdit * loopCountEdit = ( CEdit * )GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopCountEdit == nullptr ) + return; - // If the customized checkbox is off, all customization controls are disabled - // If the looping checkbox is off, the loop count control is disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 || + // If the customized checkbox is off, all customization controls are disabled + // If the looping checkbox is off, the loop count control is disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 || loopingCheckbox == nullptr || loopingCheckbox->GetCheck() == 0 ) - { - loopCountEdit->EnableWindow( false ); - } - else - { - loopCountEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the loop count has already been - // customized - Bool exists = false; - Int loopCount = 0; - if (m_dictToEdit) - { - loopCount = m_dictToEdit->getInt(TheKey_objectSoundAmbientLoopCount, &exists); - } - - if ( exists ) - { - CString loopCountText; - loopCountText.Format( "%d", loopCount ); - loopCountEdit->SetWindowText( loopCountText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the loop count - - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } - - CString loopCountText; - loopCountText.Format( "%d", audioEventInfo->m_loopCount ); - loopCountEdit->SetWindowText( loopCountText ); + { + loopCountEdit->EnableWindow( false ); + } + else + { + loopCountEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the loop count has already been + // customized + Bool exists = false; + Int loopCount = 0; + if (m_dictToEdit) + { + loopCount = m_dictToEdit->getInt(TheKey_objectSoundAmbientLoopCount, &exists); + } + + if ( exists ) + { + CString loopCountText; + loopCountText.Format( "%d", loopCount ); + loopCountEdit->SetWindowText( loopCountText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the loop count + + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } + + CString loopCountText; + loopCountText.Format( "%d", audioEventInfo->m_loopCount ); + loopCountEdit->SetWindowText( loopCountText ); } /// Move data from object to dialog controls void MapObjectProps::dictToEnabled() { - CButton * enableCheckbox = ( CButton * )GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enableCheckbox == nullptr ) - return; + CButton * enableCheckbox = ( CButton * )GetDlgItem(IDC_ENABLED_CHECKBOX); + if ( enableCheckbox == nullptr ) + return; - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - // If we don't have a sound, we can't enable it - CString currentString; - if ( soundComboBox == nullptr ) - { - enableCheckbox->EnableWindow( false ); - enableCheckbox->SetCheck( 0 ); - return; - } + // If we don't have a sound, we can't enable it + CString currentString; + if ( soundComboBox == nullptr ) + { + enableCheckbox->EnableWindow( false ); + enableCheckbox->SetCheck( 0 ); + return; + } - Int soundIndex = soundComboBox->GetCurSel(); - soundComboBox->GetLBText( soundIndex, currentString ); - if ( currentString == NO_SOUND_STRING || + Int soundIndex = soundComboBox->GetCurSel(); + soundComboBox->GetLBText( soundIndex, currentString ); + if ( currentString == NO_SOUND_STRING || ( soundIndex == m_defaultEntryIndex && m_defaultIsNone ) ) - { - enableCheckbox->SetCheck( 0 ); - enableCheckbox->EnableWindow( false ); - return; - } - else - { - enableCheckbox->EnableWindow( true ); - - // Look to see if the enabled flag has already been customized - Bool exists = false; - Bool enabled = false; - if (m_dictToEdit) - { - enabled = m_dictToEdit->getBool(TheKey_objectSoundAmbientEnabled, &exists); - } - - if ( exists ) - { - enableCheckbox->SetCheck( enabled ? 1 : 0 ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the enabled checkbox - - // Look up sound and see if it's looping. Looping-forever sounds start enabled; - // non-looping ones don't. - // Actually, by now, dictToLooping and dictToLoopCount will have looked up the - // info we need for us - // NOTE: This test should match the tests done in Object::updateObjValuesFromMapProperties() - // when it decided whether or not to enable a customized sound - CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); - CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopingCheckbox && loopCountEdit && loopingCheckbox->GetCheck() == 1 ) - { - CString loopCount; - loopCountEdit->GetWindowText( loopCount ); - - if ( atoi(loopCount) == 0 ) - { - enableCheckbox->SetCheck( 1 ); - return; - } - } - - enableCheckbox->SetCheck( 0 ); + { + enableCheckbox->SetCheck( 0 ); + enableCheckbox->EnableWindow( false ); + return; + } + else + { + enableCheckbox->EnableWindow( true ); + + // Look to see if the enabled flag has already been customized + Bool exists = false; + Bool enabled = false; + if (m_dictToEdit) + { + enabled = m_dictToEdit->getBool(TheKey_objectSoundAmbientEnabled, &exists); + } + + if ( exists ) + { + enableCheckbox->SetCheck( enabled ? 1 : 0 ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the enabled checkbox + + // Look up sound and see if it's looping. Looping-forever sounds start enabled; + // non-looping ones don't. + // Actually, by now, dictToLooping and dictToLoopCount will have looked up the + // info we need for us + // NOTE: This test should match the tests done in Object::updateObjValuesFromMapProperties() + // when it decided whether or not to enable a customized sound + CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); + CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopingCheckbox && loopCountEdit && loopingCheckbox->GetCheck() == 1 ) + { + CString loopCount; + loopCountEdit->GetWindowText( loopCount ); + + if ( atoi(loopCount) == 0 ) + { + enableCheckbox->SetCheck( 1 ); + return; + } + } + + enableCheckbox->SetCheck( 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToMinVolume() { - CEdit * minVolumeEdit = ( CEdit * )GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - minVolumeEdit->EnableWindow( false ); - } - else - { - minVolumeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the minimum volume has already been - // customized - Bool exists = false; - Real minVolume = 0.0f; - if (m_dictToEdit) - { - minVolume = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinVolume, &exists); - } - - if ( exists ) - { - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString minVolumeText; - minVolumeText.Format( "%d", REAL_TO_INT( ( minVolume * 100.0f ) + 0.5 ) ); - minVolumeEdit->SetWindowText( minVolumeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum volume - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString minVolumeText; - minVolumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_minVolume * 100.0f ) + 0.5 ) ); - minVolumeEdit->SetWindowText( minVolumeText ); + CEdit * minVolumeEdit = ( CEdit * )GetDlgItem(IDC_MIN_VOLUME_EDIT); + if ( minVolumeEdit == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + minVolumeEdit->EnableWindow( false ); + } + else + { + minVolumeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the minimum volume has already been + // customized + Bool exists = false; + Real minVolume = 0.0f; + if (m_dictToEdit) + { + minVolume = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinVolume, &exists); + } + + if ( exists ) + { + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString minVolumeText; + minVolumeText.Format( "%d", REAL_TO_INT( ( minVolume * 100.0f ) + 0.5 ) ); + minVolumeEdit->SetWindowText( minVolumeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum volume + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString minVolumeText; + minVolumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_minVolume * 100.0f ) + 0.5 ) ); + minVolumeEdit->SetWindowText( minVolumeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToVolume() { - CEdit * volumeEdit = ( CEdit * )GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - volumeEdit->EnableWindow( false ); - } - else - { - volumeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the volume has already been - // customized - Bool exists = false; - Real volume = 0.0f; - if (m_dictToEdit) - { - volume = m_dictToEdit->getReal(TheKey_objectSoundAmbientVolume, &exists); - } - - if ( exists ) - { - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString volumeText; - volumeText.Format( "%d", REAL_TO_INT( ( volume * 100.0f ) + 0.5 ) ); - volumeEdit->SetWindowText( volumeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the volume - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString volumeText; - volumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_volume * 100.0f ) + 0.5 ) ); - volumeEdit->SetWindowText( volumeText ); + CEdit * volumeEdit = ( CEdit * )GetDlgItem(IDC_VOLUME_EDIT); + if ( volumeEdit == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + volumeEdit->EnableWindow( false ); + } + else + { + volumeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the volume has already been + // customized + Bool exists = false; + Real volume = 0.0f; + if (m_dictToEdit) + { + volume = m_dictToEdit->getReal(TheKey_objectSoundAmbientVolume, &exists); + } + + if ( exists ) + { + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString volumeText; + volumeText.Format( "%d", REAL_TO_INT( ( volume * 100.0f ) + 0.5 ) ); + volumeEdit->SetWindowText( volumeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the volume + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString volumeText; + volumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_volume * 100.0f ) + 0.5 ) ); + volumeEdit->SetWindowText( volumeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToMinRange() { - CEdit * minRangeEdit = ( CEdit * )GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - minRangeEdit->EnableWindow( false ); - } - else - { - minRangeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the minimum range has already been - // customized - Bool exists = false; - Real minRange = 0.0f; - if (m_dictToEdit) - { - minRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinRange, &exists); - } - - if ( exists ) - { - CString minRangeText; - minRangeText.Format( "%d", REAL_TO_INT(minRange) ); - minRangeEdit->SetWindowText( minRangeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum range - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - CString minRangeText; - minRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_minDistance ) ); - minRangeEdit->SetWindowText( minRangeText ); + CEdit * minRangeEdit = ( CEdit * )GetDlgItem(IDC_MIN_RANGE_EDIT); + if ( minRangeEdit == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + minRangeEdit->EnableWindow( false ); + } + else + { + minRangeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the minimum range has already been + // customized + Bool exists = false; + Real minRange = 0.0f; + if (m_dictToEdit) + { + minRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinRange, &exists); + } + + if ( exists ) + { + CString minRangeText; + minRangeText.Format( "%d", REAL_TO_INT(minRange) ); + minRangeEdit->SetWindowText( minRangeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum range + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + CString minRangeText; + minRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_minDistance ) ); + minRangeEdit->SetWindowText( minRangeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToMaxRange() { - CEdit * maxRangeEdit = ( CEdit * )GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - maxRangeEdit->EnableWindow( false ); - } - else - { - maxRangeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the maximum range has already been - // customized - Bool exists = false; - Real maxRange = 0.0f; - if (m_dictToEdit) - { - maxRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMaxRange, &exists); - } - - if ( exists ) - { - CString maxRangeText; - maxRangeText.Format( "%d", REAL_TO_INT( maxRange ) ); - maxRangeEdit->SetWindowText( maxRangeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum range - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - CString maxRangeText; - maxRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_maxDistance ) ); - maxRangeEdit->SetWindowText( maxRangeText ); + CEdit * maxRangeEdit = ( CEdit * )GetDlgItem(IDC_MAX_RANGE_EDIT); + if ( maxRangeEdit == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + maxRangeEdit->EnableWindow( false ); + } + else + { + maxRangeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the maximum range has already been + // customized + Bool exists = false; + Real maxRange = 0.0f; + if (m_dictToEdit) + { + maxRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMaxRange, &exists); + } + + if ( exists ) + { + CString maxRangeText; + maxRangeText.Format( "%d", REAL_TO_INT( maxRange ) ); + maxRangeEdit->SetWindowText( maxRangeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum range + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + CString maxRangeText; + maxRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_maxDistance ) ); + maxRangeEdit->SetWindowText( maxRangeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToPriority() { - CComboBox * priorityComboBox = ( CComboBox * )GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == nullptr ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) - { - priorityComboBox->EnableWindow( false ); - } - else - { - priorityComboBox->EnableWindow( true ); - - // If customization is enabled, look to see if the maximum range has already been - // customized - Bool exists = false; - Int priorityEnum = AP_LOWEST; - if (m_dictToEdit) - { - priorityEnum = m_dictToEdit->getInt(TheKey_objectSoundAmbientPriority, &exists); - } - - if ( exists ) - { - if ( priorityEnum < 0 || priorityEnum > AP_CRITICAL ) - { - DEBUG_CRASH( ("Bad soundAmbientPriority key %d", priorityEnum ) ); - priorityEnum = AP_LOWEST; - } - - // Note: indexes of priority combobox map to priority enum - priorityComboBox->SetCurSel( priorityEnum ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the priority - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == nullptr ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == nullptr ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - priorityComboBox->SetCurSel( audioEventInfo->m_priority ); + CComboBox * priorityComboBox = ( CComboBox * )GetDlgItem(IDC_PRIORITY_COMBO); + if ( priorityComboBox == nullptr ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) + { + priorityComboBox->EnableWindow( false ); + } + else + { + priorityComboBox->EnableWindow( true ); + + // If customization is enabled, look to see if the maximum range has already been + // customized + Bool exists = false; + Int priorityEnum = AP_LOWEST; + if (m_dictToEdit) + { + priorityEnum = m_dictToEdit->getInt(TheKey_objectSoundAmbientPriority, &exists); + } + + if ( exists ) + { + if ( priorityEnum < 0 || priorityEnum > AP_CRITICAL ) + { + DEBUG_CRASH( ("Bad soundAmbientPriority key %d", priorityEnum ) ); + priorityEnum = AP_LOWEST; + } + + // Note: indexes of priority combobox map to priority enum + priorityComboBox->SetCurSel( priorityEnum ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the priority + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == nullptr ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == nullptr ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + priorityComboBox->SetCurSel( audioEventInfo->m_priority ); } @@ -2825,12 +2825,12 @@ void MapObjectProps::enableButtons() void MapObjectProps::OnOK() { - // Make sure CPropertySheet functions don't close the window + // Make sure CPropertySheet functions don't close the window } void MapObjectProps::OnCancel() { - // Make sure CPropertySheet functions don't close the window + // Make sure CPropertySheet functions don't close the window } @@ -2876,18 +2876,18 @@ Dict** MapObjectProps::getAllSelectedDictsData() /// Move data from dialog controls to object void MapObjectProps::OnScaleOn() { - _ScaleToDict(); + _ScaleToDict(); } /// Move data from dialog controls to object void MapObjectProps::OnScaleOff() { - _ScaleToDict(); + _ScaleToDict(); } /// Move data from dialog controls to object void MapObjectProps::OnKillfocusMAPOBJECTXYPosition() { - SetPosition(); + SetPosition(); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 242597a55cd..e1b668cf509 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -160,128 +160,128 @@ class PlaceholderView : public View Int m_originX, m_originY; ///< Location of top/left view corner protected: - virtual View *prependViewToList( View *list ) {return nullptr;}; ///< Prepend this view to the given list, return the new list - virtual View *getNextView( void ) { return nullptr; } ///< Return next view in the set + virtual View *prependViewToList( View *list ) override {return nullptr;}; ///< Prepend this view to the given list, return the new list + virtual View *getNextView( void ) override { return nullptr; } ///< Return next view in the set public: - virtual void init( void ){}; + virtual void init( void ) override {}; - virtual UnsignedInt getID( void ) { return 1; } + virtual UnsignedInt getID( void ) override { return 1; } - virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ){return nullptr;}; ///< pick drawable given the screen pixel coords + virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ) override {return nullptr;}; ///< pick drawable given the screen pixel coords /// all drawables in the 2D screen region will call the 'callback' virtual Int iterateDrawablesInRegion( IRegion2D *screenRegion, Bool (*callback)( Drawable *draw, void *userData ), - void *userData ) {return 0;}; - virtual WorldToScreenReturn worldToScreenTriReturn( const Coord3D *w, ICoord2D *s ) { return WTS_INVALID; }; ///< Transform world coordinate "w" into screen coordinate "s" - virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) {}; ///< transform screen coord to a point on the 3D terrain - virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) {}; ///< transform screen point to world point at the specified world Z value + void *userData ) override {return 0;}; + virtual WorldToScreenReturn worldToScreenTriReturn( const Coord3D *w, ICoord2D *s ) override { return WTS_INVALID; }; ///< Transform world coordinate "w" into screen coordinate "s" + virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) override {}; ///< transform screen coord to a point on the 3D terrain + virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) override {}; ///< transform screen point to world point at the specified world Z value virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, Coord3D *bottomRight, Coord3D *bottomLeft, - Real z ){}; + Real z ) override {}; - virtual void drawView( void ) {}; ///< Render the world visible in this view. - virtual void updateView( void ) {}; ///< Render the world visible in this view. - virtual void stepView() {}; ///< Update view for every fixed time step + virtual void drawView( void ) override {}; ///< Render the world visible in this view. + virtual void updateView( void ) override {}; ///< Render the world visible in this view. + virtual void stepView() override {}; ///< Update view for every fixed time step - virtual void setZoomLimited( Bool limit ) {} ///< limit the zoom height - virtual Bool isZoomLimited( void ) { return TRUE; } ///< get status of zoom limit + virtual void setZoomLimited( Bool limit ) override {} ///< limit the zoom height + virtual Bool isZoomLimited( void ) const override { return TRUE; } ///< get status of zoom limit - virtual void setWidth( Int width ) { m_width = width; } - virtual Int getWidth( void ) { return m_width; } - virtual void setHeight( Int height ) { m_height = height; } - virtual Int getHeight( void ) { return m_height; } - virtual void setOrigin( Int x, Int y) { m_originX=x; m_originY=y;} ///< Sets location of top-left view corner on display - virtual void getOrigin( Int *x, Int *y) { *x=m_originX; *y=m_originY;} ///< Return location of top-left view corner on display + virtual void setWidth( Int width ) override { m_width = width; } + virtual Int getWidth( void ) override { return m_width; } + virtual void setHeight( Int height ) override { m_height = height; } + virtual Int getHeight( void ) override { return m_height; } + virtual void setOrigin( Int x, Int y) override { m_originX=x; m_originY=y;} ///< Sets location of top-left view corner on display + virtual void getOrigin( Int *x, Int *y) override { *x=m_originX; *y=m_originY;} ///< Return location of top-left view corner on display - virtual void forceRedraw() { } + virtual void forceRedraw() override { } - virtual Bool isDoingScriptedCamera() { return false; } - virtual void stopDoingScriptedCamera() {} + virtual Bool isDoingScriptedCamera() override { return false; } + virtual void stopDoingScriptedCamera() override {} - virtual void lookAt( const Coord3D *o ){}; ///< Center the view on the given coordinate - virtual void initHeightForMap( void ) {}; ///< Init the camera height for the map at the current position. + virtual void lookAt( const Coord3D *o ) override {}; ///< Center the view on the given coordinate + virtual void initHeightForMap( void ) override {}; ///< Init the camera height for the map at the current position. virtual void scrollBy( Coord2D *delta ){}; ///< Shift the view by the given delta virtual void moveCameraTo(const Coord3D *o, Int frames, Int shutter, - Bool orient, Real easeIn, Real easeOut) {lookAt(o);}; + Bool orient, Real easeIn, Real easeOut) override {lookAt(o);}; virtual void moveCameraAlongWaypointPath(Waypoint *way, Int frames, Int shutter, - Bool orient, Real easeIn, Real easeOut) {}; - virtual Bool isCameraMovementFinished(void) {return true;}; - virtual void resetCamera(const Coord3D *location, Int frames, Real easeIn, Real easeOut) {}; ///< Move camera to location, and reset to default angle & zoom. - virtual void rotateCamera(Real rotations, Int frames, Real easeIn, Real easeOut) {}; ///< Rotate camera about current viewpoint. - virtual void rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMilliseconds, Real easeIn, Real easeOut) {}; ///< Rotate camera to face an object, and hold on it - virtual void cameraModFinalZoom(Real finalZoom, Real easeIn, Real easeOut){}; ///< Final zoom for current camera movement. - virtual void cameraModRollingAverage(Int framesToAverage){}; ///< Number of frames to average movement for current camera movement. - virtual void cameraModFinalTimeMultiplier(Int finalMultiplier){}; ///< Final time multiplier for current camera movement. - virtual void cameraModFinalPitch(Real finalPitch, Real easeIn, Real easeOut){}; ///< Final pitch for current camera movement. - virtual void cameraModFreezeTime(void){} ///< Freezes time during the next camera movement. - virtual void cameraModFreezeAngle(void){} ///< Freezes time during the next camera movement. - virtual void cameraModLookToward(Coord3D *pLoc){} ///< Sets a look at point during camera movement. - virtual void cameraModFinalLookToward(Coord3D *pLoc){} ///< Sets a look at point during camera movement. - virtual void cameraModFinalMoveTo(Coord3D *pLoc){ }; ///< Sets a final move to. - virtual Bool isTimeFrozen(void){ return false;} ///< Freezes time during the next camera movement. - virtual Int getTimeMultiplier(void) {return 1;}; ///< Get the time multiplier. - virtual void setTimeMultiplier(Int multiple) {}; ///< Set the time multiplier. - virtual void setDefaultView(Real pitch, Real angle, Real maxHeight) {}; - virtual void zoomCamera( Real finalZoom, Int milliseconds, Real easeIn, Real easeOut ) {}; - virtual void pitchCamera( Real finalPitch, Int milliseconds, Real easeIn, Real easeOut ) {}; - - virtual void setAngle( Real angle ){}; ///< Rotate the view around the up axis to the given angle - virtual Real getAngle( void ) { return 0; } - virtual void setPitch( Real angle ){}; ///< Rotate the view around the horizontal axis to the given angle - virtual Real getPitch( void ) { return 0; } ///< Return current camera pitch - virtual void setAngleToDefault( void ) {} ///< Set the view angle back to default - virtual void setPitchToDefault( void ) {} ///< Set the view pitch back to default + Bool orient, Real easeIn, Real easeOut) override {}; + virtual Bool isCameraMovementFinished(void) override {return true;}; + virtual void resetCamera(const Coord3D *location, Int frames, Real easeIn, Real easeOut) override {}; ///< Move camera to location, and reset to default angle & zoom. + virtual void rotateCamera(Real rotations, Int frames, Real easeIn, Real easeOut) override {}; ///< Rotate camera about current viewpoint. + virtual void rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMilliseconds, Real easeIn, Real easeOut) override {}; ///< Rotate camera to face an object, and hold on it + virtual void cameraModFinalZoom(Real finalZoom, Real easeIn, Real easeOut) override {}; ///< Final zoom for current camera movement. + virtual void cameraModRollingAverage(Int framesToAverage) override {}; ///< Number of frames to average movement for current camera movement. + virtual void cameraModFinalTimeMultiplier(Int finalMultiplier) override {}; ///< Final time multiplier for current camera movement. + virtual void cameraModFinalPitch(Real finalPitch, Real easeIn, Real easeOut) override {}; ///< Final pitch for current camera movement. + virtual void cameraModFreezeTime(void) override {} ///< Freezes time during the next camera movement. + virtual void cameraModFreezeAngle(void) override {} ///< Freezes time during the next camera movement. + virtual void cameraModLookToward(Coord3D *pLoc) override {} ///< Sets a look at point during camera movement. + virtual void cameraModFinalLookToward(Coord3D *pLoc) override {} ///< Sets a look at point during camera movement. + virtual void cameraModFinalMoveTo(Coord3D *pLoc) override { }; ///< Sets a final move to. + virtual Bool isTimeFrozen(void) override { return false;} ///< Freezes time during the next camera movement. + virtual Int getTimeMultiplier(void) override {return 1;}; ///< Get the time multiplier. + virtual void setTimeMultiplier(Int multiple) override {}; ///< Set the time multiplier. + virtual void setDefaultView(Real pitch, Real angle, Real maxHeight) override {}; + virtual void zoomCamera( Real finalZoom, Int milliseconds, Real easeIn, Real easeOut ) override {}; + virtual void pitchCamera( Real finalPitch, Int milliseconds, Real easeIn, Real easeOut ) override {}; + + virtual void setAngle( Real angle ) override {}; ///< Rotate the view around the up axis to the given angle + virtual Real getAngle( void ) override { return 0; } + virtual void setPitch( Real angle ) override {}; ///< Rotate the view around the horizontal axis to the given angle + virtual Real getPitch( void ) override { return 0; } ///< Return current camera pitch + virtual void setAngleToDefault( void ) override {} ///< Set the view angle back to default + virtual void setPitchToDefault( void ) override {} ///< Set the view pitch back to default virtual void getPosition(Coord3D *pos) {} ///< Return camera position - virtual Real getHeightAboveGround() { return 1; } - virtual void setHeightAboveGround(Real z) { } - virtual Real getZoom() { return 1; } - virtual void setZoom(Real z) { } + virtual Real getHeightAboveGround() override { return 1; } + virtual void setHeightAboveGround(Real z) override { } + virtual Real getZoom() override { return 1; } + virtual void setZoom(Real z) override { } virtual void zoomIn( void ) { } ///< Zoom in, closer to the ground, limit to min virtual void zoomOut( void ) { } ///< Zoom out, farther away from the ground, limit to max - virtual void setZoomToDefault( void ) { } ///< Set zoom to default value + virtual void setZoomToDefault( void ) override { } ///< Set zoom to default value virtual Real getMaxZoom( void ) { return 0.0f; } - virtual void setOkToAdjustHeight( Bool val ) { } ///< Set this to adjust camera height + virtual void setOkToAdjustHeight( Bool val ) override { } ///< Set this to adjust camera height - virtual Real getTerrainHeightAtPivot() { return 0.0f; } - virtual Real getCurrentHeightAboveGround() { return 0.0f; } + virtual Real getTerrainHeightAtPivot() override { return 0.0f; } + virtual Real getCurrentHeightAboveGround() override { return 0.0f; } - virtual void getLocation ( ViewLocation *location ) {}; ///< write the view's current location in to the view location object - virtual void setLocation ( const ViewLocation *location ){}; ///< set the view's current location from to the view location object + virtual void getLocation ( ViewLocation *location ) override {}; ///< write the view's current location in to the view location object + virtual void setLocation ( const ViewLocation *location ) override {}; ///< set the view's current location from to the view location object - virtual ObjectID getCameraLock() const { return INVALID_ID; } - virtual void setCameraLock(ObjectID id) { } - virtual void snapToCameraLock( void ) { } - virtual void setSnapMode( CameraLockType lockType, Real lockDist ) { } + virtual ObjectID getCameraLock() const override { return INVALID_ID; } + virtual void setCameraLock(ObjectID id) override { } + virtual void snapToCameraLock( void ) override { } + virtual void setSnapMode( CameraLockType lockType, Real lockDist ) override { } - virtual Drawable *getCameraLockDrawable() const { return nullptr; } - virtual void setCameraLockDrawable(Drawable *drawable) { } + virtual Drawable *getCameraLockDrawable() const override { return nullptr; } + virtual void setCameraLockDrawable(Drawable *drawable) override { } - virtual void setMouseLock( Bool mouseLocked ) {} ///< lock/unlock the mouse input to the tactical view - virtual Bool isMouseLocked( void ) { return FALSE; } ///< is the mouse input locked to the tactical view? + virtual void setMouseLock( Bool mouseLocked ) override {} ///< lock/unlock the mouse input to the tactical view + virtual Bool isMouseLocked( void ) override { return FALSE; } ///< is the mouse input locked to the tactical view? - virtual void setFieldOfView( Real angle ) {}; ///< Set the horizontal field of view angle - virtual Real getFieldOfView( void ) {return 0;}; ///< Get the horizontal field of view angle + virtual void setFieldOfView( Real angle ) override {}; ///< Set the horizontal field of view angle + virtual Real getFieldOfView( void ) override {return 0;}; ///< Get the horizontal field of view angle - virtual Bool setViewFilterMode(enum FilterModes) {return FALSE;} ///lightPos.x, ol->lightPos.y, ol->lightPos.z), Vector3(0,0,0)); m_globalLight[i]->Set_Transform(mtx); - m_scene->setGlobalLight(m_globalLight[i],i); - m_baseBuildScene->setGlobalLight(m_globalLight[i],i); + m_scene->setGlobalLight(m_globalLight[i],i); + m_baseBuildScene->setGlobalLight(m_globalLight[i],i); } } if(TheTerrainRenderObject) { @@ -976,7 +976,7 @@ void WbView3d::updateLights() lightP->Set_Far_Attenuation_Range(lightInnerRadius, lightOuterRadius); m_lightList.Add(lightP); - m_scene->Add_Render_Object(lightP); + m_scene->Add_Render_Object(lightP); pMapObj->setRenderObj(lightP); REF_PTR_RELEASE( lightP ); } @@ -1664,7 +1664,7 @@ BuildListInfo *WbView3d::pickedBuildObjectInView(CPoint viewPt) Coord3D cpt; Int i; viewToDocCoords(viewPt, &cpt, false); - for (i=0; igetNumSides(); i++) { + for (i=0; igetNumSides(); i++) { SidesInfo *pSide = TheSidesList->getSideInfo(i); for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { Coord3D center = *pBuild->getLocation(); @@ -1688,7 +1688,7 @@ BuildListInfo *WbView3d::pickedBuildObjectInView(CPoint viewPt) // do the intersection using W3D intersector class Bool hit = m_intersector->Intersect_Screen_Point_Layer( logX, logY, *m_buildLayer ); if( hit ) { - for (i=0; igetNumSides(); i++) { + for (i=0; igetNumSides(); i++) { SidesInfo *pSide = TheSidesList->getSideInfo(i); for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { if (pBuild->getRenderObj() == m_intersector->Result.IntersectedRenderObject) { @@ -2209,8 +2209,8 @@ BEGIN_MESSAGE_MAP(WbView3d, WbView) ON_UPDATE_COMMAND_UI(ID_VIEW_SHOWMAPBOUNDARIES, OnUpdateViewShowMapBoundaries) ON_COMMAND(ID_VIEW_SHOWAMBIENTSOUNDS, OnViewShowAmbientSounds) ON_UPDATE_COMMAND_UI(ID_VIEW_SHOWAMBIENTSOUNDS, OnUpdateViewShowAmbientSounds) - ON_COMMAND(ID_VIEW_SHOW_SOUND_CIRCLES, OnViewShowSoundCircles) - ON_UPDATE_COMMAND_UI(ID_VIEW_SHOW_SOUND_CIRCLES, OnUpdateViewShowSoundCircles) +ON_COMMAND(ID_VIEW_SHOW_SOUND_CIRCLES, OnViewShowSoundCircles) +ON_UPDATE_COMMAND_UI(ID_VIEW_SHOW_SOUND_CIRCLES, OnUpdateViewShowSoundCircles) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -2321,7 +2321,7 @@ void WbView3d::initWW3D() TheWritableGlobalData->m_enableBehindBuildingMarkers = false; //this is only for the game. if (TheW3DShadowManager==nullptr) { TheW3DShadowManager = new W3DShadowManager; - TheW3DShadowManager->init(); + TheW3DShadowManager->init(); } #endif updateLights(); @@ -2347,12 +2347,12 @@ int WbView3d::OnCreate(LPCREATESTRUCT lpCreateStruct) initWW3D(); TheWritableGlobalData->m_useCloudMap = AfxGetApp()->GetProfileInt("GameOptions", "cloudMap", 0); AfxGetApp()->WriteProfileInt("GameOptions", "cloudMap", TheGlobalData->m_useCloudMap); // Just in case it wasn't already there - m_partialMapSize = AfxGetApp()->GetProfileInt("GameOptions", "partialMapSize", 97); + m_partialMapSize = AfxGetApp()->GetProfileInt("GameOptions", "partialMapSize", 97); m_showLayersList = AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowLayersList", 0); m_showMapBoundaries = AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowMapBoundaries", 0); m_showAmbientSounds = AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowAmbientSounds", 0); - m_showSoundCircles = AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowSoundCircles", 0); + m_showSoundCircles = AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowSoundCircles", 0); DrawObject::setDoBoundaryFeedback(m_showMapBoundaries); DrawObject::setDoAmbientSoundFeedback(m_showAmbientSounds); @@ -2382,42 +2382,42 @@ void WbView3d::OnPaint() /// Draw a (not very good) circle into the hdc void WbView3d::drawCircle( HDC hdc, const Coord3D & centerPoint, Real radius, COLORREF color ) { - CPoint rulerPoints[2]; - Coord3D pnt; - Real angle = 0.0f; - Real inc = PI/4.0f; + CPoint rulerPoints[2]; + Coord3D pnt; + Real angle = 0.0f; + Real inc = PI/4.0f; - // Create and select a correctly colored pen. Remember the old one so that it can be restored. - HPEN pen = CreatePen(PS_SOLID, 2, color); - HPEN penOld = (HPEN)SelectObject(hdc, pen); + // Create and select a correctly colored pen. Remember the old one so that it can be restored. + HPEN pen = CreatePen(PS_SOLID, 2, color); + HPEN penOld = (HPEN)SelectObject(hdc, pen); - // Get the starting point on the circumference of the circle. - pnt.x = centerPoint.x + radius * (Real)cosf(angle); - pnt.y = centerPoint.y + radius * (Real)sinf(angle); - pnt.z = centerPoint.z; - docToViewCoords(pnt, &rulerPoints[0]); + // Get the starting point on the circumference of the circle. + pnt.x = centerPoint.x + radius * (Real)cosf(angle); + pnt.y = centerPoint.y + radius * (Real)sinf(angle); + pnt.z = centerPoint.z; + docToViewCoords(pnt, &rulerPoints[0]); - angle += inc; - for(; angle <= 2.0f * PI; angle += inc) { + angle += inc; + for(; angle <= 2.0f * PI; angle += inc) { // Get a new point on the circumference of the circle. pnt.x = centerPoint.x + radius * (Real)cosf(angle); - pnt.y = centerPoint.y + radius * (Real)sinf(angle); - pnt.z = centerPoint.z; + pnt.y = centerPoint.y + radius * (Real)sinf(angle); + pnt.z = centerPoint.z; - docToViewCoords(pnt, &rulerPoints[1]); + docToViewCoords(pnt, &rulerPoints[1]); - ::Polyline(hdc, rulerPoints, 2); + ::Polyline(hdc, rulerPoints, 2); - // Remember the last point to use as the starting point for the next line. - rulerPoints[0].x = rulerPoints[1].x; - rulerPoints[0].y = rulerPoints[1].y; - } + // Remember the last point to use as the starting point for the next line. + rulerPoints[0].x = rulerPoints[1].x; + rulerPoints[0].y = rulerPoints[1].y; + } - // Restore previous pen. - SelectObject(hdc, penOld); - // Delete new pen. - DeleteObject(pen); + // Restore previous pen. + SelectObject(hdc, penOld); + // Delete new pen. + DeleteObject(pen); } @@ -2553,23 +2553,23 @@ void WbView3d::drawLabels(HDC hdc) if (hdc && m_doRulerFeedback) { if (m_doRulerFeedback == RULER_LINE) { - // Change world coords to screen viewport coords. - CPoint rulerPoints[2]; - docToViewCoords(m_rulerPoints[0], &rulerPoints[0]); - docToViewCoords(m_rulerPoints[1], &rulerPoints[1]); - - // Create and select a green pen. Remember the old one so that it can be restored. - HPEN pen = CreatePen(PS_SOLID, 2, RGB(0,255,0)); - HPEN penOld = (HPEN)SelectObject(hdc, pen); - // Draw the line ruler. + // Change world coords to screen viewport coords. + CPoint rulerPoints[2]; + docToViewCoords(m_rulerPoints[0], &rulerPoints[0]); + docToViewCoords(m_rulerPoints[1], &rulerPoints[1]); + + // Create and select a green pen. Remember the old one so that it can be restored. + HPEN pen = CreatePen(PS_SOLID, 2, RGB(0,255,0)); + HPEN penOld = (HPEN)SelectObject(hdc, pen); + // Draw the line ruler. ::Polyline(hdc, rulerPoints, 2); - // Restore previous pen. - SelectObject(hdc, penOld); - // Delete new pen. - DeleteObject(pen); + // Restore previous pen. + SelectObject(hdc, penOld); + // Delete new pen. + DeleteObject(pen); } else if (m_doRulerFeedback == RULER_CIRCLE) { - drawCircle( hdc, m_rulerPoints[0], m_rulerLength, RGB( 0, 255, 0 ) ); + drawCircle( hdc, m_rulerPoints[0], m_rulerLength, RGB( 0, 255, 0 ) ); } } @@ -3252,14 +3252,14 @@ void WbView3d::OnUpdateViewShowAmbientSounds(CCmdUI* pCmdUI) void WbView3d::OnViewShowSoundCircles() { - m_showSoundCircles = !m_showSoundCircles; - ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowSoundCircles", m_showSoundCircles ? 1 : 0); - resetRenderObjects(); - invalObjectInView(nullptr); + m_showSoundCircles = !m_showSoundCircles; + ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowSoundCircles", m_showSoundCircles ? 1 : 0); + resetRenderObjects(); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewShowSoundCircles(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(m_showSoundCircles ? 1 : 0); + pCmdUI->SetCheck(m_showSoundCircles ? 1 : 0); } diff --git a/GeneralsMD/Code/Tools/wdump/wdtview.cpp b/GeneralsMD/Code/Tools/wdump/wdtview.cpp index 55dee7370ba..c289793818c 100644 --- a/GeneralsMD/Code/Tools/wdump/wdtview.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdtview.cpp @@ -242,7 +242,7 @@ ChunkItem *CWDumpTreeView::FindChunkItem (ChunkItem *selectedchunkitem, ChunkIte searchstate = SEARCH_WRAPPED; return (nullptr); } else { - if ((chunkitem != nullptr) && (chunkitem->Type != nullptr) && (chunkitem->Type->Callback != nullptr)) { + if ((chunkitem != nullptr) && (chunkitem->Type != nullptr) && (chunkitem->Type->Callback != nullptr)) { (*chunkitem->Type->Callback)(chunkitem, nullptr); } if (FindDialog::Found()) return (chunkitem); diff --git a/GeneralsMD/Code/Tools/wdump/wdump.cpp b/GeneralsMD/Code/Tools/wdump/wdump.cpp index ccf59123749..f76c6e093a9 100644 --- a/GeneralsMD/Code/Tools/wdump/wdump.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdump.cpp @@ -78,7 +78,7 @@ CWdumpApp theApp; // private class declaration of a CCommandLineInfo class that knows about our special options class CWDumpCommandLineInfo : public CCommandLineInfo { - virtual void ParseParam(const TCHAR* pszParam,BOOL bFlag,BOOL bLast) + virtual void ParseParam(const TCHAR* pszParam,BOOL bFlag,BOOL bLast) override { if (bFlag) { @@ -223,7 +223,7 @@ class CAboutDlg : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support //}}AFX_VIRTUAL // Implementation diff --git a/scripts/cpp/convert_leading_spaces_to_tabs.py b/scripts/cpp/convert_leading_spaces_to_tabs.py new file mode 100644 index 00000000000..94ac3733f96 --- /dev/null +++ b/scripts/cpp/convert_leading_spaces_to_tabs.py @@ -0,0 +1,478 @@ +""" +Convert leading spaces to tabs using tree-sitter for accurate C++ parsing. + +Uses the tree-sitter C++ parser to determine the correct indentation depth +of each line, then replaces leading whitespace with the correct number of tabs. + +Only converts lines where the tool is confident about the correct depth. +Lines inside block comments, continuation lines, and ambiguous cases are +skipped and logged. + +Requirements: + pip install tree-sitter tree-sitter-cpp + +Usage: + python convert_leading_spaces_to_tabs.py [--dry-run] [--verbose] +""" + +import argparse +import glob +import os +import re + +import tree_sitter_cpp as tscpp +from tree_sitter import Language, Parser + + +CPP_LANGUAGE = Language(tscpp.language()) + + +# Macros that confuse tree-sitter's C++ parser. These are expanded in the +# source text before parsing (but not in the output). Replacements are +# same-length to preserve byte offsets between the parsed and original text. +MACRO_EXPANSIONS = [ + (re.compile(rb'\bCALLBACK\b'), b' '), + (re.compile(rb'\bGCALL\b'), b' '), + (re.compile(rb'\bWINAPI\b'), b' '), + (re.compile(rb'\bIN\b'), b' '), + (re.compile(rb'\bOUT\b'), b' '), + (re.compile(rb'\bRO\b'), b' '), + (re.compile(rb'\bW3DNEW\b'), b'new '), + (re.compile(rb'\bNEW\b'), b'new'), + (re.compile(rb'\b__RPC_FAR\b'), b' '), + (re.compile(rb'\b__RPC_STUB\b'), b' '), + (re.compile(rb'\b__asm\b'), b' '), + (re.compile(rb'\b_asm\b'), b' '), +] + + +def preprocess_for_parsing(code_bytes): + """Apply macro expansions to help tree-sitter parse the code.""" + result = code_bytes + for pattern, replacement in MACRO_EXPANSIONS: + result = pattern.sub(replacement, result) + return result + + +# Node types that create an indentation level for their children. +SCOPE_CREATING_TYPES = frozenset({ + 'compound_statement', + 'field_declaration_list', + 'declaration_list', # namespace body + 'enumerator_list', + 'initializer_list', + 'case_statement', +}) + +# Control-flow statements whose braceless body should be indented one level. +BRACELESS_BODY_PARENTS = frozenset({ + 'if_statement', + 'while_statement', + 'for_statement', + 'do_statement', + 'else_clause', +}) + + +def get_indent_depth(node): + """Walk up the AST and count scope-creating ancestors to determine indent depth.""" + depth = 0 + current = node.parent + prev = node + + while current is not None: + if current.type in SCOPE_CREATING_TYPES: + # Special case: a compound_statement that is a direct child of + # case_statement does not add an extra indent level. The case_statement + # already provides the indent, and the braces are at the case level. + if (current.type == 'compound_statement' + and current.parent is not None + and current.parent.type == 'case_statement'): + pass # don't increment + else: + depth += 1 + elif current.type in BRACELESS_BODY_PARENTS: + # If prev is the body/consequence of a braceless control-flow + # statement, it needs one extra indent level. + body_field = (current.child_by_field_name('consequence') + or current.child_by_field_name('body') + or current.child_by_field_name('alternative')) + if (body_field is not None + and body_field.id == prev.id + and body_field.type != 'compound_statement'): + depth += 1 + prev = current + current = current.parent + + return depth + + +def is_continuation_line(node, line_num): + """Check if this line is a continuation of a multi-line statement. + + A continuation line is one where the innermost meaningful AST node + started on a previous line. We skip these because their alignment + is a style choice we don't want to change in this PR. + """ + if node is None: + return False + + # Walk up to find the nearest statement-level node + current = node + while current is not None: + # If this node starts on our line, it's not a continuation + if current.start_point[0] == line_num: + current = current.parent + continue + + # If the node started on a previous line and is a statement-level + # construct, this is a continuation line + if current.start_point[0] < line_num: + if current.type in ( + 'declaration', 'field_declaration', 'expression_statement', + 'return_statement', 'init_declarator', 'argument_list', + 'parameter_list', 'condition_clause', 'call_expression', + 'binary_expression', 'assignment_expression', + 'function_declarator', 'template_argument_list', + 'field_initializer_list', 'field_initializer', + 'base_class_clause', 'initializer_pair', + ): + return True + current = current.parent + + return False + + + + + +def process_file(filepath, dry_run=False, verbose=False): + """Process a single file, converting leading spaces to tabs. + + Returns (changed, skipped, total_lines) tuple. + """ + parser = Parser(CPP_LANGUAGE) + + try: + with open(filepath, 'r', encoding='cp1252') as f: + content = f.read() + except (UnicodeDecodeError, OSError): + return 0, 0, 0 + + lines = content.split('\n') + # Preserve original line endings + if content.endswith('\n'): + lines = lines[:-1] # split adds an empty string after trailing \n + + code_bytes = content.encode('utf-8') + parse_bytes = preprocess_for_parsing(code_bytes) + tree = parser.parse(parse_bytes) + + # If the file has excessive parse errors, the AST is unreliable - skip it. + # Only count top-level errors (not deeply nested ones from macro expansions). + error_count = sum(1 for child in tree.root_node.children if child.type == 'ERROR') + if error_count > 10: + if verbose: + print(f" SKIP file (too many top-level parse errors: {error_count})") + return 0, 0, len(lines) + + new_lines = [] + changed = 0 + skipped = 0 + in_block_comment = False + in_macro_continuation = False + in_asm_block = False + asm_brace_depth = 0 + asm_pending = False + pp_depth = 0 + + for line_idx, line in enumerate(lines): + # Track block comments manually for reliability + stripped = line.lstrip() + line_continues_macro = line.rstrip().endswith('\\') + + if in_block_comment: + # Inside a block comment - don't touch + new_lines.append(line) + if '*/' in line: + in_block_comment = False + continue + + if stripped.startswith('/*'): + if '*/' not in stripped or stripped.index('*/') < stripped.index('/*') + 2: + in_block_comment = '*/' not in stripped[2:] + new_lines.append(line) + continue + + # Inline assembly blocks - don't touch (uses spaces for alignment) + if in_asm_block: + new_lines.append(line) + asm_brace_depth += stripped.count('{') - stripped.count('}') + if asm_brace_depth <= 0: + in_asm_block = False + continue + + # Check for pending asm block (keyword was on previous line) + if asm_pending: + asm_pending = False + if stripped.startswith('{'): + in_asm_block = True + asm_brace_depth = stripped.count('{') - stripped.count('}') + if asm_brace_depth <= 0: + in_asm_block = False + new_lines.append(line) + continue + + # Multi-line macro continuations - don't touch + if in_macro_continuation: + new_lines.append(line) + in_macro_continuation = line_continues_macro + continue + + # Blank lines - preserve as-is + if stripped == '': + new_lines.append(line) + continue + + # Preprocessor directives - always column 0 + if stripped.startswith('#'): + # Track preprocessor nesting depth + directive = stripped.lstrip('#').lstrip() + if directive.startswith(('if ', 'if\t', 'ifdef ', 'ifdef\t', + 'ifndef ', 'ifndef\t')): + pp_depth += 1 + elif directive.startswith('endif'): + pp_depth = max(0, pp_depth - 1) + new_lines.append(line) + in_macro_continuation = line_continues_macro + continue + + # Check for inline assembly block start + if re.search(r'\b__?asm\b', stripped) and not stripped.startswith('//'): + if '{' in stripped: + in_asm_block = True + asm_brace_depth = stripped.count('{') - stripped.count('}') + if asm_brace_depth <= 0: + in_asm_block = False + else: + asm_pending = True + new_lines.append(line) + continue + + # Check if the line already uses tabs (no leading spaces) + leading_ws = line[:len(line) - len(line.lstrip())] + if ' ' not in leading_ws: + # Already all tabs (or no indentation) - keep as-is + new_lines.append(line) + continue + + # Tabs-then-spaces: the spaces are for visual alignment, not indentation. + # E.g. a continuation comment aligned under a previous line's comment. + if leading_ws[0] == '\t': + first_space = leading_ws.find(' ') + if first_space > 0 and '\t' not in leading_ws[first_space:]: + new_lines.append(line) + skipped += 1 + if verbose: + print(f" SKIP tab-align L{line_idx+1}: {line.rstrip()[:80]}") + continue + + # Mixed whitespace with spaces before tabs: if the spaces are minor + # (1-3), they're stray characters and tab count is the real depth. + # If spaces are significant (4+), fall through to tree-sitter. + tab_count = leading_ws.count('\t') + if tab_count > 0: + first_tab_pos = leading_ws.index('\t') + if first_tab_pos < 4: + new_line = '\t' * tab_count + stripped + if new_line != line: + changed += 1 + if verbose: + print(f" CHANGE L{line_idx+1} (mixed->tabs={tab_count}): '{leading_ws}' -> '{chr(9)*tab_count}'") + new_lines.append(new_line) + continue + + # This line has pure leading spaces. + # Use tree-sitter to determine the correct depth. + # Find the AST node at the first non-whitespace character. + col = len(leading_ws) + node = tree.root_node.descendant_for_point_range( + (line_idx, col), (line_idx, col) + ) + + if node is None: + new_lines.append(line) + skipped += 1 + continue + + # Skip if the node or any ancestor is an ERROR node (parse failure) + error_ancestor = False + check = node + while check is not None: + if check.type == 'ERROR': + error_ancestor = True + break + check = check.parent + if error_ancestor: + new_lines.append(line) + skipped += 1 + if verbose: + print(f" SKIP parse error L{line_idx+1}: {line.rstrip()[:80]}") + continue + + # For comment nodes, we can reindent // line comments but + # should skip /* */ block comments (their internal formatting + # is intentional). Block comments are already handled by the + # in_block_comment tracking above, so single-line comments + # that tree-sitter reports as 'comment' are fine to reindent. + # However, single-line /* */ comments on their own line are also + # fine to reindent. + + # Skip continuation lines + if is_continuation_line(node, line_idx): + new_lines.append(line) + skipped += 1 + if verbose: + print(f" SKIP continuation L{line_idx+1}: {line.rstrip()[:80]}") + continue + + # Calculate expected depth + depth = get_indent_depth(node) + + # Special handling: the opening/closing braces of a compound_statement + # should be at the parent's depth, not the compound_statement's depth. + if node.type in ('{', '}'): + parent = node.parent + if parent is not None and parent.type in SCOPE_CREATING_TYPES: + # For a compound_statement inside case_statement, braces should + # be at the case label level (case_statement's own depth) + if (parent.type == 'compound_statement' + and parent.parent is not None + and parent.parent.type == 'case_statement'): + depth = get_indent_depth(parent.parent) + else: + depth = get_indent_depth(parent) + + # Special handling: case/default labels - they are children of + # case_statement but should be at the case_statement's depth + # (the 'case' keyword itself) + if node.type in ('case', 'default'): + parent = node.parent + if parent is not None and parent.type == 'case_statement': + depth = get_indent_depth(parent) + + # Special handling: access specifiers (public/private/protected) + # These sit at the class brace level, not indented inside the class body. + if node.type in ('public', 'private', 'protected'): + access_spec = node.parent # access_specifier node + if access_spec is not None and access_spec.type == 'access_specifier': + field_list = access_spec.parent # field_declaration_list + if field_list is not None: + depth = get_indent_depth(field_list) + + # Special handling: the colon after access specifier + if node.type == ':': + parent = node.parent + if parent is not None and parent.type == 'access_specifier': + field_list = parent.parent + if field_list is not None: + depth = get_indent_depth(field_list) + + # Sanity check: if the line had significant indentation but we + # computed depth 0, something is likely wrong (parse errors nearby, + # inline assembly corrupting the AST, etc). Skip to be safe. + # Also skip depth-0 lines inside preprocessor blocks — the codebase + # convention is to indent C++ code inside #if/#ifdef blocks, but + # tree-sitter doesn't model preprocessor nesting. + space_count = len(leading_ws) + if depth == 0 and space_count > 0 and pp_depth > 0: + new_lines.append(line) + skipped += 1 + if verbose: + print(f" SKIP pp-indent L{line_idx+1}: depth=0 but pp_depth={pp_depth}: {line.rstrip()[:80]}") + continue + if depth == 0 and space_count >= 4: + new_lines.append(line) + skipped += 1 + if verbose: + print(f" SKIP sanity L{line_idx+1}: depth=0 but {space_count} spaces: {line.rstrip()[:80]}") + continue + + # Build the new line: depth tabs + original content (no leading whitespace) + new_line = '\t' * depth + stripped + if new_line != line: + changed += 1 + if verbose: + print(f" CHANGE L{line_idx+1} (depth={depth}): '{leading_ws}' -> '{chr(9)*depth}'") + new_lines.append(new_line) + + # Track mid-line block comment opens (e.g. /**< trailing doc comments) + last_open = stripped.rfind('/*') + if last_open >= 0: + after_open = stripped[last_open + 2:] + if '*/' not in after_open: + in_block_comment = True + + if changed > 0 and not dry_run: + with open(filepath, 'w', encoding='cp1252') as f: + f.write('\n'.join(new_lines)) + if content.endswith('\n'): + f.write('\n') + + return changed, skipped, len(lines) + + +def main(): + parser = argparse.ArgumentParser( + description='Convert leading spaces to tabs using tree-sitter C++ parsing.' + ) + parser.add_argument('--dry-run', action='store_true', + help='Show what would change without modifying files') + parser.add_argument('--verbose', '-v', action='store_true', + help='Print details about each changed/skipped line') + parser.add_argument('--file', type=str, + help='Process a single file instead of the whole codebase') + args = parser.parse_args() + + script_dir = os.path.dirname(os.path.abspath(__file__)) + root_dir = os.path.normpath(os.path.join(script_dir, '..', '..')) + + if args.file: + file_list = [args.file] + else: + top_dirs = [ + os.path.join(root_dir, 'Core'), + os.path.join(root_dir, 'Generals'), + os.path.join(root_dir, 'GeneralsMD'), + os.path.join(root_dir, 'Dependencies', 'Utility'), + ] + file_list = [] + for ext in ['*.cpp', '*.h', '*.inl']: + for top_dir in top_dirs: + file_list.extend( + glob.glob(os.path.join(top_dir, '**', ext), recursive=True) + ) + + total_changed = 0 + total_skipped = 0 + total_files_modified = 0 + + for filepath in sorted(file_list): + changed, skipped, total_lines = process_file( + filepath, dry_run=args.dry_run, verbose=args.verbose + ) + if changed > 0: + total_files_modified += 1 + rel = os.path.relpath(filepath, root_dir) + action = "Would change" if args.dry_run else "Changed" + print(f"{action} {changed} lines in {rel}") + total_changed += changed + total_skipped += skipped + + action = "Would change" if args.dry_run else "Changed" + print(f"\n{action} {total_changed} lines across {total_files_modified} files") + print(f"Skipped {total_skipped} lines (continuations, ambiguous)") + + +if __name__ == '__main__': + main()