set_amiga_key(KEYCODE_SPACE, 1);
set_amiga_key(KEYCODE_SPACE, 0);
}
+ if (button_right_thumb && !button_right_thumb_last) {
+ /* 'change orientation' pressed */
+ double roll, pitch, yaw;
+ mercenary_get_orientation(&roll, &pitch, &yaw);
+ mercenary_set_orientation(yaw + hand_right_yaw);
+ }
if (button_trigger && !button_trigger_last) {
/* trigger pressed */
if (!keyboard_on) {
}
}
/* joystick */
- if (stick_right_x > STICK_ROTATE_THRESHOLD)
+ if (stick_right_x > STICK_ROTATE_THRESHOLD && !mercenary_get_info_walking())
set_joystick(0, 1, -1, -1, -1);
else
- if (stick_right_x < -STICK_ROTATE_THRESHOLD)
+ if (stick_right_x < -STICK_ROTATE_THRESHOLD && !mercenary_get_info_walking())
set_joystick(1, 0, -1, -1, -1);
else
if (stick_right_x_last > STICK_ROTATE_THRESHOLD || stick_right_x_last < -STICK_ROTATE_THRESHOLD)
"\n"
"Walking / Driving / Flying using Controller:\n"
" Use thumb stick on right controller, to move player / craft.\n"
+ " Point right controller towards the direction to walk to.\n"
+ " Press thumb stick to change orientation to that direction.\n"
" Press `X' button to board, `Y' button to leave.\n"
" Move thumb stick on left controller to drive/fly forward or backward.\n"
" Press and hold thumb stick on left controller for escape sequence.\n"
uint32_t mercenary_palette_stars(void);
uint32_t mercenary_object_vertex_register(void);
void mercenary_get_orientation(double *roll, double *pitch, double *yaw);
+void mercenary_set_orientation(double yaw);
void mercenary_get_orientation_raw(int16_t *pitch, uint16_t *yaw);
void mercenary_get_orientation_planet(double *inclination, double *azimuth, int improved);
void mercenary_get_location(int32_t *east, int32_t *height, int32_t *north);
uint32_t mercenary_planet_scale_index(void);
uint32_t mercenary_star_table(void);
void mercenary_vr_move(int override, int32_t *east, int32_t *north, int yaw, int pitch);
+int mercenary_get_info_walking(void);
extern const char *mercenary_name;
extern const char *mercenary_gamesavesuffix;
#define INITIAL_STACK 0x7fffa
#define RESET_VECTOR 0x59484
+static int info_walking = 0;
+
/* VR heading to alter direction we walk to */
static struct vr_move vr_move;
{ 0x528C4, STOP_AT_PATCH_RENDER }, /* patch away planet check (behind observer) */
{ 0x45806, STOP_AT_PATCH_RENDER }, /* patch away planet rendering (would crash without check above) */
{ 0x53276, STOP_AT_PATCH_RENDER }, /* patch away beacon check (not visible on screen) */
+ { 0x59622, STOP_AT_PATCH_VR }, /* we are walking/taxi */
+ { 0x597CA, STOP_AT_PATCH_VR }, /* we are on a craft */
+ { 0x597F2, STOP_AT_PATCH_VR }, /* we are ??? */
+ { 0x59944, STOP_AT_PATCH_VR }, /* we are in space */
{ 0x58EA8, STOP_AT_PATCH_VR }, /* step that moves player on surface */
{ 0x58060, STOP_AT_PATCH_VR }, /* soft pitch over planet */
{ 0x58918, STOP_AT_PATCH_VR }, /* soft pitch in space */
void mercenary_patch_vr(void)
{
switch (REG_PC) {
+ case 0x59622: /* we are walking/taxi */
+ info_walking = 1;
+ break;
+ case 0x597CA: /* we are on a craft */
+ info_walking = 0;
+ break;
+ case 0x597F2: /* we are ??? */
+ info_walking = 0;
+ break;
+ case 0x59944: /* we are in space */
+ info_walking = 0;
+ break;
case 0x58EA8: /* at this point we process one step of the player walking on the ground */
if (vr_move.override && vr_move.index < 4) {
REG_D[2] = vr_move.east[vr_move.index];
*yaw = -(double)r / 1024.0 * 2 * M_PI;
}
+void mercenary_set_orientation(double yaw)
+{
+ int16_t r;
+
+ /* set the oberver */
+ r = (int16_t)fmod(-yaw * 1024.0 / 2.0 / M_PI, 1024.0);
+ m68k_write_memory_16(0x007AC2, (r - 0x200) & 0x3ff);
+}
+
void mercenary_get_orientation_raw(int16_t *pitch, uint16_t *yaw)
{
*pitch = m68k_read_memory_16(0x007AA0);
vr_move.index = 0;
}
+int mercenary_get_info_walking(void)
+{
+ return info_walking;
+}
+
const char *mercenary_name = "Mercenary II - Damocles";
const char *mercenary_gamesavesuffix = ".m2save";
#define RESET_VECTOR 0x5a16c
// #define RESET_VECTOR 0x5a1a4 /* strange reset vector that causes the player to fly around */
+static int info_walking = 0;
+
/* VR heading to alter direction we walk to */
static struct vr_move vr_move;
{ 0x537B0, STOP_AT_PATCH_RENDER }, /* patch away planet check (behind observer) */
{ 0x45806, STOP_AT_PATCH_RENDER }, /* patch away planet rendering (would crash without check above) */
{ 0x5406E, STOP_AT_PATCH_RENDER }, /* patch away beacon check (not visible on screen) */
+ { 0x5A3BA, STOP_AT_PATCH_VR }, /* we are walking/taxi */
+ { 0x5A576, STOP_AT_PATCH_VR }, /* we are on a craft */
+ { 0x5A5A4, STOP_AT_PATCH_VR }, /* we are ??? */
+ { 0x5A71A, STOP_AT_PATCH_VR }, /* we are in space */
{ 0x59A00, STOP_AT_PATCH_VR }, /* step that moves player on surface */
{ 0x58F44, STOP_AT_PATCH_VR }, /* soft pitch over planet */
{ 0x5946E, STOP_AT_PATCH_VR }, /* soft pitch in space */
void mercenary_patch_vr(void)
{
switch (REG_PC) {
+ case 0x5A3BA: /* we are walking/taxi */
+ info_walking = 1;
+ break;
+ case 0x5A576: /* we are on a craft */
+ info_walking = 0;
+ break;
+ case 0x5A5A4: /* we are ??? */
+ info_walking = 0;
+ break;
+ case 0x5A71A: /* we are in space */
+ info_walking = 0;
+ break;
case 0x59A00: /* at this point we process one step of the player walking on the ground */
if (vr_move.override && vr_move.index < 4) {
REG_D[2] = vr_move.east[vr_move.index];
*yaw = -(double)r / 1024.0 * 2 * M_PI;
}
+void mercenary_set_orientation(double yaw)
+{
+ int16_t r;
+
+ /* set the oberver */
+ r = (int16_t)fmod(-yaw * 1024.0 / 2.0 / M_PI, 1024.0);
+ m68k_write_memory_16(DS_0+0x1E4a, (r - 0x200) & 0x3ff);
+}
+
void mercenary_get_orientation_raw(int16_t *pitch, uint16_t *yaw)
{
*pitch = m68k_read_memory_16(DS_0+0x1E28);
vr_move.index = 0;
}
+int mercenary_get_info_walking(void)
+{
+ return info_walking;
+}
+
const char *mercenary_name = "Mercenary III - The Dion Crisis";
const char *mercenary_gamesavesuffix = ".m3save";