Browse Source

[SDL1.2] Check if an appropriate video mode exists for the given movie

This lets us fall back to software scaling for devices that do not
support a video mode that matches the given video.
pull/867/head
Anders Jenbo 6 years ago
parent
commit
93358a290c
  1. 24
      SourceX/storm/storm.cpp

24
SourceX/storm/storm.cpp

@ -623,6 +623,30 @@ void SVidPlayBegin(char *filename, int a2, int a3, int a4, int a5, int flags, HA
{
const auto *display = SDL_GetVideoSurface();
IsSVidVideoMode = (display->flags & (SDL_FULLSCREEN | SDL_NOFRAME)) != 0;
if (IsSVidVideoMode) {
/* Get available fullscreen/hardware modes */
SDL_Rect **modes = SDL_ListModes(NULL, display->flags);
/* Check is there are any modes available */
if(modes == (SDL_Rect **)0){
IsSVidVideoMode = false;
}
/* Check if our resolution is restricted */
if(modes != (SDL_Rect **)-1){
// Search for a usable video mode
bool UsableModeFound = false;
for (int i=0; modes[i]; i++) {
if (modes[i]->w == SVidWidth || modes[i]->h == SVidHeight) {
UsableModeFound = true;
break;
}
}
IsSVidVideoMode = UsableModeFound;
}
}
if (IsSVidVideoMode) {
int w, h;
if (display->w * SVidWidth > display->h * SVidHeight) {

Loading…
Cancel
Save