soft: fix build with SDL3

This commit is contained in:
Denis Pauk 2025-02-10 00:25:30 +02:00
parent ae21db84d8
commit 3d3e7e9c98
3 changed files with 18 additions and 1 deletions

View file

@ -19,6 +19,7 @@ State:
* base2: no known issues,
* mguhub: sometimes broken logic for surface fall in next maps.
* SOFT:
* build with SDL3 has glitch in menu,
* base1: broken wall light and wall glitch,
* base2: broken wall light and wall glitch,
* q64/outpost: scale textures unsupported,

View file

@ -385,7 +385,7 @@ RE_Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *d
RE_Draw_StretchPicImplementation (x, y, w, h, &pic);
if (r_retexturing->value)
if (image_scaled != (byte *)data)
{
free(image_scaled);
}

View file

@ -2341,7 +2341,11 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
}
/* Full screen update should be faster */
#ifdef USE_SDL3
if (!SDL_LockTexture(texture_rgba, NULL, (void**)&pixels, &pitch))
#else
if (SDL_LockTexture(texture_rgba, NULL, (void**)&pixels, &pitch))
#endif
{
Com_Printf("Can't lock texture: %s\n", SDL_GetError());
return;
@ -2377,16 +2381,28 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
if (cols == vid_buffer_width && rows == vid_buffer_height)
{
#ifdef USE_SDL3
SDL_RenderTexture(renderer, texture_rgba, NULL, NULL);
#else
SDL_RenderCopy(renderer, texture_rgba, NULL, NULL);
#endif
}
else
{
#ifdef USE_SDL3
SDL_FRect srcrect;
#else
SDL_Rect srcrect;
#endif
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = cols;
srcrect.h = rows;
#ifdef USE_SDL3
SDL_RenderTexture(renderer, texture_rgba, &srcrect, NULL);
#else
SDL_RenderCopy(renderer, texture_rgba, &srcrect, NULL);
#endif
}
SDL_RenderPresent(renderer);