OVR: Cleanup code that selects between OVR and regular version
authorAndreas Eversberg <jolly@eversberg.eu>
Sun, 29 Apr 2018 16:51:57 +0000 (18:51 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 29 Apr 2018 16:51:57 +0000 (18:51 +0200)
src/mercenary/main.c

index ac1a81e..1b3656d 100644 (file)
@@ -667,6 +667,9 @@ static void main_loop(void)
        int all_white = 0;
 #ifdef HAVE_OVR
        int eye;
+       int vr = 1;
+#else
+       int vr = 0;
 #endif
 
        last_time = ticks_sdl();
@@ -750,11 +753,7 @@ static void main_loop(void)
                {
 #endif
                        /* clear screen */
-#ifdef HAVE_OVR
-                       opengl_clear(1);
-#else
-                       opengl_clear(0);
-#endif
+                       opengl_clear(vr);
                        /* render benson + osd ontop of improved opengl rendering, if enabled */
                        if (render_improved) {
 #ifndef HAVE_OVR
@@ -764,36 +763,17 @@ static void main_loop(void)
                                /* render improved graphics, interpolate, if required,
                                 * if no item list is available, for legacy rendering
                                 */
-#ifdef HAVE_OVR
                                if (all_white)
-                                       rc = render_all_white(1);
+                                       rc = render_all_white(vr);
                                else
-                                       rc = render_all_items((config_amiga_speed) ? 1.0 : frame_time, 1);
-#else
-                               if (all_white)
-                                       rc = render_all_white(0);
-                               else
-                                       rc = render_all_items((config_amiga_speed) ? 1.0 : frame_time, 0);
-#endif
+                                       rc = render_all_items((config_amiga_speed) ? 1.0 : frame_time, vr);
                                if (rc)
                                        goto goto_legacy;
-#ifdef HAVE_OVR
-                               opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size, 1);
-#else
-                               opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size, 0);
-#endif
+                               opengl_blit_image(image, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, 1, config_fov, config_monitor_distance, benson_size, vr);
                                if (help_view)
-#ifdef HAVE_OVR
-                                       opengl_blit_osd(0, help_osd[help_view - 1], config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, FOV_NOVAGEN, config_monitor_distance, 1.0, 1.0, 1.0, 0.0, 0.0);
-#else
-                                       opengl_blit_osd(0, help_osd[help_view - 1], config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, config_fov, config_monitor_distance, benson_size, 1.0, 1.0, 0.0, 0.0);
-#endif
+                                       opengl_blit_osd(0, help_osd[help_view - 1], config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, (vr) ? FOV_NOVAGEN : config_fov, config_monitor_distance, (vr) ? 1.0 : benson_size, 1.0, 1.0, 0.0, 0.0);
                                if (osd_timer) {
-#ifdef HAVE_OVR
-                                       opengl_blit_osd(1, info_osd, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, FOV_NOVAGEN, config_monitor_distance, 1.0, 0.5, 0.04, 0.5, -0.95);
-#else
-                                       opengl_blit_osd(1, info_osd, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, config_fov, config_monitor_distance, benson_size, 0.5, 0.04, 0.5, -0.95);
-#endif
+                                       opengl_blit_osd(1, info_osd, config_video_filter, (double_pixel_size) ? BENSON_AT_LINE * 2 : BENSON_AT_LINE, (vr) ? FOV_NOVAGEN : config_fov, config_monitor_distance, (vr) ? 1.0 : benson_size, 0.5, 0.04, 0.5, -0.95);
                                        if (osd_timer - (int32_t)ticks_sdl() < 0)
                                                osd_timer = 0;
                                }
@@ -1302,18 +1282,18 @@ int main(int argc, char *argv[])
        /* init SDL and OpenGL */
 #ifdef HAVE_OVR
        int vbl_sync = 0;
-       int rift = 1;
+       int vr = 1;
        int multisampling = 0;
        window_width = SCREEN_WIDTH;
        window_height = SCREEN_HEIGHT;
 #else
        int vbl_sync = 1;
-       int rift = 0;
+       int vr = 0;
        int multisampling = config_multisampling;
        window_width = (config_debug_opengl) ? SCREEN_WIDTH / 3 * 2 : SCREEN_WIDTH;
        window_height = (config_debug_opengl) ? SCREEN_HEIGHT / 3 * 4 : SCREEN_HEIGHT;
 #endif
-       rc = init_sdl(argv[0], window_width, window_height, SOUND_SAMPLERATE, sdl_sound_chunk, keyboard_sdl, audio_sdl, resize_window, multisampling, vbl_sync, rift);
+       rc = init_sdl(argv[0], window_width, window_height, SOUND_SAMPLERATE, sdl_sound_chunk, keyboard_sdl, audio_sdl, resize_window, multisampling, vbl_sync, vr);
        if (rc < 0)
                goto done;
 #ifdef HAVE_OVR