projects
/
mercenary-reloaded.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OVR: Fixup thrust control
[mercenary-reloaded.git]
/
src
/
mercenary
/
main.c
diff --git
a/src/mercenary/main.c
b/src/mercenary/main.c
index
c514326
..
520dc8f
100644
(file)
--- a/
src/mercenary/main.c
+++ b/
src/mercenary/main.c
@@
-402,7
+402,7
@@
static void handle_vr_poses(void)
/* menu toggle */
toggle_help();
}
/* menu toggle */
toggle_help();
}
- if (button_
lef
t_thumb) {
+ if (button_
righ
t_thumb) {
/* reset observer */
reset_observer_ovr();
osd_info("", "reset observer");
/* reset observer */
reset_observer_ovr();
osd_info("", "reset observer");
@@
-534,13
+534,18
@@
static void handle_vr_poses(void)
set_joystick(-1, -1, 0, 0, -1);
/* thrust */
/* button to toggle between stop and escape */
set_joystick(-1, -1, 0, 0, -1);
/* thrust */
/* button to toggle between stop and escape */
- if (button_left_t
rigger && !button_left_trigger
_last) {
+ if (button_left_t
humb && !button_left_thumb
_last) {
/* 'escape' pressed */
/* 'escape' pressed */
- if (thrust_last
== 0
)
+ if (thrust_last
!= -99
)
thrust = -99;
else
thrust = 0;
}
thrust = -99;
else
thrust = 0;
}
+ /* button to stop */
+ if (button_left_trigger && !button_left_trigger_last) {
+ /* 'stop' pressed */
+ thrust = 0;
+ }
/* get stick to increment or decrement thrust */
if (stick_left_y > STICK_THRUST_THRESHOLD)
increment = (stick_left_y - STICK_THRUST_THRESHOLD) / (1.0 - STICK_THRUST_THRESHOLD);
/* get stick to increment or decrement thrust */
if (stick_left_y > STICK_THRUST_THRESHOLD)
increment = (stick_left_y - STICK_THRUST_THRESHOLD) / (1.0 - STICK_THRUST_THRESHOLD);
@@
-553,6
+558,9
@@
static void handle_vr_poses(void)
if (increment) {
diff = current_time - last_time;
inc_count += increment * diff;
if (increment) {
diff = current_time - last_time;
inc_count += increment * diff;
+ /* if we are in 'escape' mode, we stop thrust first */
+ if (thrust == -99)
+ thrust = 0;
if (inc_count > 150.0 && thrust >= -10 && thrust < 10) {
thrust++;
inc_count = 0.0;
if (inc_count > 150.0 && thrust >= -10 && thrust < 10) {
thrust++;
inc_count = 0.0;
@@
-567,6
+575,12
@@
static void handle_vr_poses(void)
last_time = current_time;
/* send thrust change as keycodes */
if (thrust_last != thrust) {
last_time = current_time;
/* send thrust change as keycodes */
if (thrust_last != thrust) {
+ /* if we were in escape mode, we stop us first and then apply the new code */
+ if (thrust_last == -99) {
+ set_amiga_key(KEYCODE_SPACE, 1);
+ set_amiga_key(KEYCODE_SPACE, 0);
+ }
+
if (thrust >= 10) {
set_amiga_key(KEYCODE_0, 1);
set_amiga_key(KEYCODE_0, 0);
if (thrust >= 10) {
set_amiga_key(KEYCODE_0, 1);
set_amiga_key(KEYCODE_0, 0);
@@
-1402,7
+1416,7
@@
int main(int argc, char *argv[])
" 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 `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"
- " P
ull `Trigger' on left controller for escape sequence, after stop
.\n"
+ " P
ress thumb stick on left controller for escape sequence and stop it
.\n"
" Pull `Trigger' on right controller to fire.\n"
"\n"
"For all other game function, use the virtual or real keyboard!\n"
" Pull `Trigger' on right controller to fire.\n"
"\n"
"For all other game function, use the virtual or real keyboard!\n"