Skip to content

Commit 3535e1e

Browse files
committed
Include screenshot implementation directly in W3DDisplay.cpp to avoid PCH issues
1 parent 4e9c510 commit 3535e1e

File tree

6 files changed

+20
-80
lines changed

6 files changed

+20
-80
lines changed

Generals/Code/GameEngineDevice/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ set(GAMEENGINEDEVICE_SRC
140140
Source/W3DDevice/GameClient/W3DDebugDisplay.cpp
141141
Source/W3DDevice/GameClient/W3DDebugIcons.cpp
142142
Source/W3DDevice/GameClient/W3DDisplay.cpp
143-
Source/W3DDevice/GameClient/W3DScreenshot.cpp
144143
Source/W3DDevice/GameClient/W3DDisplayString.cpp
145144
Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp
146145
Source/W3DDevice/GameClient/W3DDynamicLight.cpp

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,16 +2886,7 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height)
28862886
}
28872887

28882888
///Save Screen Capture to a file
2889-
2890-
void W3DDisplay::takeScreenShotCompressed(void)
2891-
{
2892-
W3D_TakeCompressedScreenshot(SCREENSHOT_JPEG);
2893-
}
2894-
2895-
void W3DDisplay::takeScreenShotPNG(void)
2896-
{
2897-
W3D_TakeCompressedScreenshot(SCREENSHOT_PNG);
2898-
}
2889+
#include "W3DScreenshot.cpp"
28992890

29002891
/** Start/Stop capturing an AVI movie*/
29012892
void W3DDisplay::toggleMovieCapture(void)

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScreenshot.cpp

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,3 @@
1-
/*
2-
** Command & Conquer Generals Zero Hour(tm)
3-
** Copyright 2025 Electronic Arts Inc.
4-
**
5-
** This program is free software: you can redistribute it and/or modify
6-
** it under the terms of the GNU General Public License as published by
7-
** the Free Software Foundation, either version 3 of the License, or
8-
** (at your option) any later version.
9-
**
10-
** This program is distributed in the hope that it will be useful,
11-
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
** GNU General Public License for more details.
14-
**
15-
** You should have received a copy of the GNU General Public License
16-
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*/
18-
19-
#include "W3DDevice/GameClient/W3DScreenshot.h"
20-
21-
#include <stdlib.h>
22-
#include <windows.h>
23-
#include <io.h>
24-
25-
#include "Common/GlobalData.h"
26-
#include "GameClient/InGameUI.h"
27-
#include "GameClient/GameText.h"
28-
#include "WW3D2/dx8wrapper.h"
29-
#include "WW3D2/surface.h"
301
#include <stb_image_write.h>
312

323
struct ScreenshotThreadData
@@ -152,3 +123,12 @@ void W3D_TakeCompressedScreenshot(ScreenshotFormat format, int quality)
152123
TheInGameUI->message(TheGameText->fetch("GUI:ScreenCapture"), ufileName.str());
153124
}
154125

126+
void W3DDisplay::takeScreenShotCompressed(void)
127+
{
128+
W3D_TakeCompressedScreenshot(SCREENSHOT_JPEG);
129+
}
130+
131+
void W3DDisplay::takeScreenShotPNG(void)
132+
{
133+
W3D_TakeCompressedScreenshot(SCREENSHOT_PNG);
134+
}

GeneralsMD/Code/GameEngineDevice/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ set(GAMEENGINEDEVICE_SRC
151151
Source/W3DDevice/GameClient/W3DDebugDisplay.cpp
152152
Source/W3DDevice/GameClient/W3DDebugIcons.cpp
153153
Source/W3DDevice/GameClient/W3DDisplay.cpp
154-
Source/W3DDevice/GameClient/W3DScreenshot.cpp
155154
Source/W3DDevice/GameClient/W3DDisplayString.cpp
156155
Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp
157156
Source/W3DDevice/GameClient/W3DDynamicLight.cpp

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,16 +3005,7 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height)
30053005
}
30063006

30073007
///Save Screen Capture to a file
3008-
3009-
void W3DDisplay::takeScreenShotCompressed(void)
3010-
{
3011-
W3D_TakeCompressedScreenshot(SCREENSHOT_JPEG);
3012-
}
3013-
3014-
void W3DDisplay::takeScreenShotPNG(void)
3015-
{
3016-
W3D_TakeCompressedScreenshot(SCREENSHOT_PNG);
3017-
}
3008+
#include "W3DScreenshot.cpp"
30183009

30193010
/** Start/Stop capturing an AVI movie*/
30203011
void W3DDisplay::toggleMovieCapture(void)

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScreenshot.cpp

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,3 @@
1-
/*
2-
** Command & Conquer Generals Zero Hour(tm)
3-
** Copyright 2025 Electronic Arts Inc.
4-
**
5-
** This program is free software: you can redistribute it and/or modify
6-
** it under the terms of the GNU General Public License as published by
7-
** the Free Software Foundation, either version 3 of the License, or
8-
** (at your option) any later version.
9-
**
10-
** This program is distributed in the hope that it will be useful,
11-
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
** GNU General Public License for more details.
14-
**
15-
** You should have received a copy of the GNU General Public License
16-
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*/
18-
19-
#include "W3DDevice/GameClient/W3DScreenshot.h"
20-
21-
#include <stdlib.h>
22-
#include <windows.h>
23-
#include <io.h>
24-
25-
#include "Common/GlobalData.h"
26-
#include "GameClient/InGameUI.h"
27-
#include "GameClient/GameText.h"
28-
#include "WW3D2/dx8wrapper.h"
29-
#include "WW3D2/surface.h"
301
#include <stb_image_write.h>
312

323
struct ScreenshotThreadData
@@ -152,3 +123,12 @@ void W3D_TakeCompressedScreenshot(ScreenshotFormat format, int quality)
152123
TheInGameUI->message(TheGameText->fetch("GUI:ScreenCapture"), ufileName.str());
153124
}
154125

126+
void W3DDisplay::takeScreenShotCompressed(void)
127+
{
128+
W3D_TakeCompressedScreenshot(SCREENSHOT_JPEG);
129+
}
130+
131+
void W3DDisplay::takeScreenShotPNG(void)
132+
{
133+
W3D_TakeCompressedScreenshot(SCREENSHOT_PNG);
134+
}

0 commit comments

Comments
 (0)