Implement SCALE_2X for Fallout 2 (#306)
This commit is contained in:
parent
cf5f865a23
commit
0ffcb107af
19
src/svga.cc
19
src/svga.cc
|
@ -102,6 +102,7 @@ void _zero_vid_mem()
|
||||||
int _GNW95_init_mode_ex(int width, int height, int bpp)
|
int _GNW95_init_mode_ex(int width, int height, int bpp)
|
||||||
{
|
{
|
||||||
bool fullscreen = true;
|
bool fullscreen = true;
|
||||||
|
int scale = 1;
|
||||||
|
|
||||||
Config resolutionConfig;
|
Config resolutionConfig;
|
||||||
if (configInit(&resolutionConfig)) {
|
if (configInit(&resolutionConfig)) {
|
||||||
|
@ -121,6 +122,18 @@ int _GNW95_init_mode_ex(int width, int height, int bpp)
|
||||||
fullscreen = !windowed;
|
fullscreen = !windowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int scaleValue;
|
||||||
|
if (configGetInt(&resolutionConfig, "MAIN", "SCALE_2X", &scaleValue)) {
|
||||||
|
scale = scaleValue + 1; // 0 = 1x, 1 = 2x
|
||||||
|
// Only allow scaling if resulting game resolution is >= 640x480
|
||||||
|
if ((width / scale) < 640 || (height / scale) < 480) {
|
||||||
|
scale = 1;
|
||||||
|
} else {
|
||||||
|
width /= scale;
|
||||||
|
height /= scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configGetBool(&resolutionConfig, "IFACE", "IFACE_BAR_MODE", &gInterfaceBarMode);
|
configGetBool(&resolutionConfig, "IFACE", "IFACE_BAR_MODE", &gInterfaceBarMode);
|
||||||
configGetInt(&resolutionConfig, "IFACE", "IFACE_BAR_WIDTH", &gInterfaceBarWidth);
|
configGetInt(&resolutionConfig, "IFACE", "IFACE_BAR_WIDTH", &gInterfaceBarWidth);
|
||||||
configGetInt(&resolutionConfig, "IFACE", "IFACE_BAR_SIDE_ART", &gInterfaceSidePanelsImageId);
|
configGetInt(&resolutionConfig, "IFACE", "IFACE_BAR_SIDE_ART", &gInterfaceSidePanelsImageId);
|
||||||
|
@ -129,7 +142,7 @@ int _GNW95_init_mode_ex(int width, int height, int bpp)
|
||||||
configFree(&resolutionConfig);
|
configFree(&resolutionConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_GNW95_init_window(width, height, fullscreen) == -1) {
|
if (_GNW95_init_window(width, height, fullscreen, scale) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +170,7 @@ int _init_vesa_mode(int width, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4CAEDC
|
// 0x4CAEDC
|
||||||
int _GNW95_init_window(int width, int height, bool fullscreen)
|
int _GNW95_init_window(int width, int height, bool fullscreen, int scale)
|
||||||
{
|
{
|
||||||
if (gSdlWindow == NULL) {
|
if (gSdlWindow == NULL) {
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||||
|
@ -172,7 +185,7 @@ int _GNW95_init_window(int width, int height, bool fullscreen)
|
||||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
gSdlWindow = SDL_CreateWindow(gProgramWindowTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, windowFlags);
|
gSdlWindow = SDL_CreateWindow(gProgramWindowTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width * scale, height * scale, windowFlags);
|
||||||
if (gSdlWindow == NULL) {
|
if (gSdlWindow == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void _get_start_mode_();
|
||||||
void _zero_vid_mem();
|
void _zero_vid_mem();
|
||||||
int _GNW95_init_mode_ex(int width, int height, int bpp);
|
int _GNW95_init_mode_ex(int width, int height, int bpp);
|
||||||
int _init_vesa_mode(int width, int height);
|
int _init_vesa_mode(int width, int height);
|
||||||
int _GNW95_init_window(int width, int height, bool fullscreen);
|
int _GNW95_init_window(int width, int height, bool fullscreen, int scale);
|
||||||
int directDrawInit(int width, int height, int bpp);
|
int directDrawInit(int width, int height, int bpp);
|
||||||
void directDrawFree();
|
void directDrawFree();
|
||||||
void directDrawSetPaletteInRange(unsigned char* a1, int a2, int a3);
|
void directDrawSetPaletteInRange(unsigned char* a1, int a2, int a3);
|
||||||
|
|
Loading…
Reference in New Issue