OVR: Rework on virtual VR keyboard
[mercenary-reloaded.git] / src / mercenary / main.c
index 1b3656d..24ea8a0 100644 (file)
@@ -73,8 +73,8 @@ static double config_fov = FOV_NOVAGEN;
 #endif
 static double config_monitor_distance = 31.5; /* inch */
 #ifdef HAVE_OVR
-static double config_keyboard_distance = 28.5; /* inch */
-static double config_keyboard_height = 4.0; /* inch */
+static double config_keyboard_distance = 30.5; /* inch */
+static double config_keyboard_height = -22.0; /* inch */
 #endif
 static int config_debug_transparent = 0;
 static int config_debug_opengl = 0;
@@ -83,6 +83,7 @@ static int config_improve_extend_roads = 1;   /* set to 1 to extend roads */
 static int config_improve_smooth_planets = 1;  /* set to 1 to rotate planets smoothly */
 static int config_improve_stars_rotation = 1;  /* set to 1 to improve star rendering */
 static int config_improve_fix_sky_rotation = 0;        /* set to 1 to fix sky rotation */
+static int config_improve_round_planets = 0;   /* set to 1 to make planets exactly round */
 
 #define CPU_SPEED      7093790.0;
 
@@ -186,6 +187,11 @@ int parse_args(int argc, char *argv[])
                        print_info("        fixed by rotating all sky object by 180 degrees. The original (wrong)\n");
                        print_info("        rotation is default, because it preserves the game's spirit!\n");
                        print_info("        This option requires OpenGL rendering. (default = %d)\n", config_improve_fix_sky_rotation);
+                       print_info("    --round-planets 1 | 0\n");
+                       print_info("        The original game renders planets and explosion debris horizontally\n");
+                       print_info("        stretched. This compensates the vertical stretch of NTSC vs PAL video.\n");
+                       print_info("        The original (stretched) sphere makes the game authentic.\n");
+                       print_info("        This option requires OpenGL rendering. (default = %d)\n", config_improve_round_planets);
                        print_info("Debug options:\n");
                        print_info(" -o --debug-opengl\n");
                        print_info("        Use split screen to display both Amiga and OpenGL rendering.\n");
@@ -312,6 +318,12 @@ illegal_parameter:
                                goto missing_parameter;
                        config_improve_fix_sky_rotation = atoi(argv[i]);
                } else
+               if (!strcmp(argv[i], "--round-planets")) {
+                       i++;
+                       if (argc == i)
+                               goto missing_parameter;
+                       config_improve_round_planets = atoi(argv[i]);
+               } else
                if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--debug-opengl")) {
                        config_debug_opengl = 1;
                } else
@@ -388,20 +400,6 @@ static void handle_vr_poses(void)
                osd_info("", "reset observer");
        }
        if (!help_view) {
-               if (button_a && !button_a_last) {
-                       /* keyboard A toggle */
-                       if (keyboard_on == 1)
-                               keyboard_on = 0;
-                       else
-                               keyboard_on = 1;
-               }
-               if (button_b && !button_b_last) {
-                       /* keyboard B toggle */
-                       if (keyboard_on == 2)
-                               keyboard_on = 0;
-                       else
-                               keyboard_on = 2;
-               }
                if (button_x && !button_x_last) {
                        /* 'board' pressed */
                        set_amiga_key(KEYCODE_b, 1);
@@ -602,8 +600,7 @@ static void handle_vr_poses(void)
        /* we must handle keyboard after toggeling keyboard_on,
         * so that keyboard_on will not change until keyboard is rendered */
        vr_key = 0;
-       if (keyboard_on)
-               handle_vr_keyboard(keyboard_on - 1, hand_right_x, hand_right_y, hand_right_z, hand_right_yaw, hand_right_pitch, &vr_key);
+       keyboard_on = handle_vr_keyboard(hand_right_x, hand_right_y, hand_right_z, hand_right_yaw, hand_right_pitch, &vr_key);
 }
 #endif
 
@@ -718,7 +715,7 @@ static void main_loop(void)
                        frame_render = 0;
                        /* start capturing for improved graphics */
                        if (render_improved)
-                               render_capture_start(config_fov, config_improve_extend_roads, config_improve_smooth_planets, config_improve_stars_rotation, config_improve_fix_sky_rotation, config_debug_transparent);
+                               render_capture_start(config_fov, config_improve_extend_roads, config_improve_smooth_planets, config_improve_stars_rotation, config_improve_fix_sky_rotation, config_improve_round_planets, config_debug_transparent);
 
                        /* execute until the rendered image is ready (wait for VBL) */
                        cycle_count = 0;
@@ -803,7 +800,7 @@ static void main_loop(void)
 #ifdef HAVE_OVR
                        /* render keyboard */
                        if (keyboard_on)
-                               render_vr_keyboard(keyboard_on - 1, camera_x, camera_y);
+                               render_vr_keyboard(camera_x, camera_y);
 
                        /* end of rendering eye */
                        end_render_ovr_eye(eye);
@@ -1372,10 +1369,8 @@ int main(int argc, char *argv[])
        text_render(help_osd[1], IMAGE_WIDTH * 2, IMAGE_HEIGHT * 2,
                "Emulation using Controller:\n"
                "        Press `Enter' button to toggle this help screen on or off.\n"
-               "        Press `A' button to emulate keyboard to control game.\n"
-               "        Press `B' button to emulate keyboard to enter alphanumeric keys.\n"
-               "        Press `A' or `B' button again to dismiss keyboard.\n"
-               "        Point right controller to a key on keyboard. The key will highlight.\n"
+               "        To have a virtual keyboard, point below benson (control pannel).\n"
+               "        Point to a key on keyboard. The key will highlight.\n"
                "        Pull `Trigger' on right controller enter the highlighted key.\n"
                "        Pull `Trigger' on both controllers to reset observer position.\n"
                "\n"