Skip to content

Commit 4721192

Browse files
authored
Merge branch 'master' into Fix-spawn-item-error-va-eval
2 parents 3d5e1ed + 6142282 commit 4721192

File tree

4 files changed

+42
-25
lines changed

4 files changed

+42
-25
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ jobs:
6868
shell: bash
6969
run: cmake --install . --config ${{ matrix.build_type }}
7070

71-
- uses: actions/upload-artifact@v3
71+
- uses: actions/upload-artifact@v4
7272
if: ${{ matrix.build_type == 'Release' }}
7373
with:
7474
name: OpenJK-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
7575
path: ${{ github.workspace }}/build/bin/JediAcademy
7676
if-no-files-found: error
7777

78-
- uses: actions/upload-artifact@v3
78+
- uses: actions/upload-artifact@v4
7979
if: ${{ matrix.build_type == 'Release' }}
8080
with:
8181
name: OpenJO-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
@@ -149,14 +149,14 @@ jobs:
149149
shell: bash
150150
run: tar -czvf OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
151151

152-
- uses: actions/upload-artifact@v3
152+
- uses: actions/upload-artifact@v4
153153
if: ${{ matrix.build_type == 'Release' }}
154154
with:
155155
name: OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
156156
path: ${{github.workspace}}/install/JediAcademy/OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
157157
if-no-files-found: error
158158

159-
- uses: actions/upload-artifact@v3
159+
- uses: actions/upload-artifact@v4
160160
if: ${{ matrix.build_type == 'Release' }}
161161
with:
162162
name: OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
@@ -169,11 +169,11 @@ jobs:
169169
strategy:
170170
fail-fast: false
171171
matrix:
172-
runner: [macos-12, macos-14]
172+
runner: [macos-13, macos-14]
173173
build_type: [Debug, Release]
174174
portable: [Non-Portable]
175175
include:
176-
- runner: macos-12
176+
- runner: macos-13
177177
arch: x86_64
178178
- runner: macos-14
179179
arch: arm64
@@ -226,14 +226,14 @@ jobs:
226226
chmod +x openjo_sp.${{ matrix.arch }}.app/Contents/MacOS/openjo_sp.${{ matrix.arch }}
227227
tar -czvf openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
228228
229-
- uses: actions/upload-artifact@v3
229+
- uses: actions/upload-artifact@v4
230230
if: ${{ matrix.build_type == 'Release' }}
231231
with:
232232
name: OpenJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
233233
path: ${{ github.workspace }}/install/JediAcademy/openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
234234
if-no-files-found: error
235235

236-
- uses: actions/upload-artifact@v3
236+
- uses: actions/upload-artifact@v4
237237
if: ${{ matrix.build_type == 'Release' }}
238238
with:
239239
name: OpenJO-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
@@ -250,7 +250,7 @@ jobs:
250250
submodules: recursive
251251

252252
- name: Download Artifacts
253-
uses: actions/download-artifact@v3
253+
uses: actions/download-artifact@v4
254254

255255
- name: Create binary archives
256256
run: |
@@ -341,7 +341,7 @@ jobs:
341341
submodules: recursive
342342

343343
- name: Download Artifacts
344-
uses: actions/download-artifact@v3
344+
uses: actions/download-artifact@v4
345345

346346
- name: Create archive
347347
run: |

code/client/cl_scrn.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ void SCR_PrecacheScreenshot()
554554

555555
}
556556

557+
// Returns a SG_SCR_WIDTH x SG_SCR_HEIGHT screenshot buffer
558+
// Must match color components with DrawStretchRaw: 4
557559
byte *SCR_GetScreenshot(qboolean *qValid)
558560
{
559561
if (!screenDataValid) {

code/rd-vanilla/tr_draw.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,11 @@ void RE_GetScreenShot(byte *buffer, int w, int h)
198198
b += src[2];
199199
}
200200
}
201-
dst = buffer + 3 * ( y * w + x );
201+
dst = buffer + 4 * ((h - y - 1) * w + x );
202202
dst[0] = r / 12;
203203
dst[1] = g / 12;
204204
dst[2] = b / 12;
205+
dst[3] = 255;
205206
}
206207
}
207208

code/server/sv_savegame.cpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,19 +1030,20 @@ static void SG_WriteScreenshot(qboolean qbAutosave, const char *psMapName)
10301030

10311031
byte *pbRawScreenShot = NULL;
10321032
byte *byBlank = NULL;
1033+
byte *src, *dst;
10331034

10341035
if( qbAutosave )
10351036
{
10361037
// try to read a levelshot (any valid TGA/JPG etc named the same as the map)...
10371038
//
10381039
int iWidth = SG_SCR_WIDTH;
10391040
int iHeight= SG_SCR_HEIGHT;
1040-
const size_t bySize = SG_SCR_WIDTH * SG_SCR_HEIGHT * 4;
1041-
byte *src, *dst;
1042-
1041+
const size_t bySize = SG_SCR_WIDTH * SG_SCR_HEIGHT * 4;
1042+
10431043
byBlank = new byte[bySize];
1044-
pbRawScreenShot = SCR_TempRawImage_ReadFromFile(va("levelshots/%s.tga",psMapName), &iWidth, &iHeight, byBlank, qtrue); // qtrue = vert flip
1044+
pbRawScreenShot = SCR_TempRawImage_ReadFromFile(va("levelshots/%s.tga",psMapName), &iWidth, &iHeight, byBlank, qfalse); // qfalse = vert flip
10451045

1046+
// SaveJPGToBuffer expects a 3 component RGB image, so resample
10461047
if (pbRawScreenShot)
10471048
{
10481049
for (int y = 0; y < iHeight; y++)
@@ -1061,23 +1062,36 @@ static void SG_WriteScreenshot(qboolean qbAutosave, const char *psMapName)
10611062

10621063
if (!pbRawScreenShot)
10631064
{
1065+
const size_t bySize = SG_SCR_WIDTH * SG_SCR_HEIGHT * 3;
1066+
1067+
byBlank = new byte[bySize];
10641068
pbRawScreenShot = SCR_GetScreenshot(0);
1069+
1070+
// We can't just do the same resampling as with qbAutosave as we would alter the cached buffer
1071+
// That might be used elsewhere and is expected to have RGBA data, like for drawing the level transition screenshot
1072+
if (pbRawScreenShot)
1073+
{
1074+
for (int y = 0; y < SG_SCR_HEIGHT; y++)
1075+
{
1076+
for (int x = 0; x < SG_SCR_WIDTH; x++)
1077+
{
1078+
src = pbRawScreenShot + 4 * (y * SG_SCR_WIDTH + x);
1079+
dst = byBlank + 3 * (y * SG_SCR_WIDTH + x);
1080+
dst[0] = src[0];
1081+
dst[1] = src[1];
1082+
dst[2] = src[2];
1083+
}
1084+
}
1085+
pbRawScreenShot = byBlank;
1086+
}
10651087
}
10661088

1067-
10681089
size_t iJPGDataSize = 0;
10691090
size_t bufSize = SG_SCR_WIDTH * SG_SCR_HEIGHT * 3;
10701091
byte *pJPGData = (byte *)Z_Malloc( static_cast<int>(bufSize), TAG_TEMP_WORKSPACE, qfalse, 4 );
10711092

1072-
#ifdef JK2_MODE
1073-
bool flip_vertical = true;
1074-
#else
1075-
bool flip_vertical = false;
1076-
#endif // JK2_MODE
1077-
1078-
iJPGDataSize = re.SaveJPGToBuffer(pJPGData, bufSize, JPEG_IMAGE_QUALITY, SG_SCR_WIDTH, SG_SCR_HEIGHT, pbRawScreenShot, 0, flip_vertical );
1079-
if ( qbAutosave )
1080-
delete[] byBlank;
1093+
iJPGDataSize = re.SaveJPGToBuffer(pJPGData, bufSize, JPEG_IMAGE_QUALITY, SG_SCR_WIDTH, SG_SCR_HEIGHT, pbRawScreenShot, 0, false );
1094+
delete[] byBlank;
10811095

10821096
saved_game.write_chunk<uint32_t>(
10831097
INT_ID('S', 'H', 'L', 'N'),

0 commit comments

Comments
 (0)