static int help_view = 1;
static int help_views = 0;
static int32_t osd_timer = 0, border_timer = 0;
-#ifdef HAVE_OVR
-#define SCREEN_WIDTH 1344
-#define SCREEN_HEIGHT 800
-#else
#define SCREEN_WIDTH (320*3)
#define SCREEN_HEIGHT (200*3)
-#endif
#define IMAGE_WIDTH 320
#define IMAGE_HEIGHT 200
#define BENSON_AT_LINE 136
static int keyboard_on = 0;
static enum keycode vr_key_pressed = 0, vr_key = 0;
static int we_walk = 0, we_rotate = 0;
+static double degrees45 = 45.0 / 180.0 * M_PI;
static void handle_vr_poses(void)
{
mercenary_vr_move(1, move_east, move_north, 256, 256);
}
- /* if we rotate */
+ /* snap orientation to steps of 45 degrees */
if (we_rotate == 1) {
- /* change orientation */
mercenary_get_orientation(&roll, &pitch, &yaw);
+ yaw = round(yaw / degrees45) * degrees45;
+ /* if we rotate: change orientation */
if (stick_right_x > 0)
- mercenary_set_orientation(yaw - 45.0 / 180.0 * M_PI);
+ yaw -= degrees45;
else
- mercenary_set_orientation(yaw + 45.0 / 180.0 * M_PI);
- /* rotate only once */
+ yaw += degrees45;
+ /* rotate only once per stick movement */
we_rotate = 2;
+ mercenary_set_orientation(yaw);
}
}
if (joystick_set_x_last && !joystick_set_x)
/* render result on window */
while (!quit) {
#ifdef HAVE_OVR
+ /* quit by OVR server */
+ if (should_quit_ovr())
+ break;
/* get vr poses */
handle_vr_poses();
#endif
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, config_joystick, config_joystick_x, config_joystick_y, config_joystick_fire, joystick_sdl, audio_sdl, resize_window, multisampling, vbl_sync, vr);
+ rc = init_sdl(mercenary_name, window_width, window_height, SOUND_SAMPLERATE, sdl_sound_chunk, keyboard_sdl, config_joystick, config_joystick_x, config_joystick_y, config_joystick_fire, joystick_sdl, audio_sdl, resize_window, multisampling, vbl_sync, vr);
if (rc < 0)
goto done;
#ifdef HAVE_OVR
"Walking / Driving / Flying using Controller:\n"
" Use thumb stick on right controller, to move player / craft.\n"
" Move thumb stick forth and back to walk, left and right to rotate.\n"
- " Pull `Trigger' on right controller to change orientation.\n"
- " Press `X' button to board, `Y' button to leave.\n"
" Move thumb stick on left controller to drive/fly forward or backward.\n"
" Pull `Trigger' on left controller stop craft.\n"
" Press thumb stick on left controller for escape sequence and stop it.\n"