From 42ab8dd6afe71b4dc65ed6765919cb588a4a5b01 Mon Sep 17 00:00:00 2001 From: erysdren Date: Tue, 6 Aug 2024 16:33:00 -0500 Subject: [PATCH] Catch invalid resolution in CONFIG.ROT (#80) * Catch invalid resolution in CONFIG.ROT * rt_cfg.c: logic error * rt_cfg.c: logic error part 2 --- rott/rt_cfg.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rott/rt_cfg.c b/rott/rt_cfg.c index 10913b6..1e71a9e 100644 --- a/rott/rt_cfg.c +++ b/rott/rt_cfg.c @@ -428,6 +428,14 @@ boolean ParseConfigFile (void) ReadInt("ScreenWidth", &iGLOBAL_SCREENWIDTH); ReadInt("ScreenHeight", &iGLOBAL_SCREENHEIGHT); + if ((iGLOBAL_SCREENWIDTH != 320 || iGLOBAL_SCREENHEIGHT != 200) && + (iGLOBAL_SCREENWIDTH != 640 || iGLOBAL_SCREENHEIGHT != 480)) + { + printf("WARNING: Invalid screen resolution %dx%d. Reverting to 640x480.\n", iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT); + iGLOBAL_SCREENWIDTH = 640; + iGLOBAL_SCREENHEIGHT = 480; + } + // Read in ViewSize ReadInt("ViewSize",&viewsize);