]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Added {0,0} to vid_resolutions and added the macro/constant VID_RES_COUNT
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 11 Nov 2003 20:20:11 +0000 (20:20 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 11 Nov 2003 20:20:11 +0000 (20:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3637 d7cf8633-e32d-0410-b094-e92efae38249

menu.c

diff --git a/menu.c b/menu.c
index 05cbd0f56408df51307fcdcc31e843d7db597bef..f552bfd95275ab6d8a1ef3b1e9456d34cb3a61e9 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -2146,7 +2146,8 @@ int video_cursor = 0;
 int video_cursor_table[] = {56, 68, 80, 100};
 // note: if modes are added to the beginning of this list, update the
 // video_resolution = x; in M_Menu_Video_f below
-unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,480}, {800,600}, {1024,768}, {1152,864}, {1280,960}, {1280,1024}, {1600,1200}, {1792,1344}, {1920,1440}, {2048,1536}};
+unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,480}, {800,600}, {1024,768}, {1152,864}, {1280,960}, {1280,1024}, {1600,1200}, {1792,1344}, {1920,1440}, {2048,1536}, {0,0}};
+#define VID_RES_COUNT ((int)sizeof(video_resolutions) / sizeof(video_resolutions[0]) - 1)
 int video_resolution;
 
 extern int current_vid_fullscreen;
@@ -2162,7 +2163,7 @@ void M_Menu_Video_f (void)
        m_entersound = true;
 
        // Look for the current resolution
-       for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
+       for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
        {
                if (video_resolutions[video_resolution][0] == current_vid_width &&
                        video_resolutions[video_resolution][1] == current_vid_height)
@@ -2170,7 +2171,7 @@ void M_Menu_Video_f (void)
        }
 
        // Default to 800x600 if we didn't find it
-       if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
+       if (video_resolution == VID_RES_COUNT)
        {
                // may need to update this number if mode list changes
                video_resolution = 4;
@@ -2223,8 +2224,8 @@ void M_Menu_Video_AdjustSliders (int dir)
                {
                        int new_resolution = video_resolution + dir;
                        if (new_resolution < 0)
-                               video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
-                       else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
+                               video_resolution = VID_RES_COUNT - 1;
+                       else if (new_resolution > VID_RES_COUNT)
                                video_resolution = 0;
                        else
                                video_resolution = new_resolution;