mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-17 13:00:25 +02:00
Merge branch 'feature/vr-hud-fixes'
This commit is contained in:
commit
a3ee36b5ef
3 files changed
+61
-7
No files matched your search
@@ -813,6 +813,15 @@ In the menus the buttons are the Xbox's by position: A accepts, B goes back. */
|
||||
int halo_vr_controllers(struct halo_xr_hand hands[HALO_XR_HAND_COUNT], int *menus);
|
||||
int halo_vr_wheel_held(void);
|
||||
|
||||
/* a click that stands for the pad's A (ui_widget.c: the screen where
|
||||
controllers join by pressing it), held a moment */
|
||||
static Uint64 vr_pad_a_until;
|
||||
|
||||
void halo_vr_pulse_pad_a(void)
|
||||
{
|
||||
vr_pad_a_until = SDL_GetTicks() + 120;
|
||||
}
|
||||
|
||||
static SHORT vr_stick(float value)
|
||||
{
|
||||
if (value > 1.0f)
|
||||
@@ -859,7 +868,8 @@ static void vr_gamepad_state(XINPUT_GAMEPAD *pad)
|
||||
if (abs(value) > abs(pad->sThumbRX)) pad->sThumbRX = value;
|
||||
value = vr_stick(right->thumbstick[1]);
|
||||
if (abs(value) > abs(pad->sThumbRY)) pad->sThumbRY = value;
|
||||
merge_button(pad, XINPUT_GAMEPAD_A, (right->buttons & HALO_XR_BUTTON_A) != 0);
|
||||
merge_button(pad, XINPUT_GAMEPAD_A, (right->buttons & HALO_XR_BUTTON_A) != 0 ||
|
||||
SDL_GetTicks() < vr_pad_a_until);
|
||||
merge_button(pad, XINPUT_GAMEPAD_B, (right->buttons & HALO_XR_BUTTON_B) != 0);
|
||||
merge_button(pad, XINPUT_GAMEPAD_X, (left->buttons & HALO_XR_BUTTON_A) != 0);
|
||||
merge_button(pad, XINPUT_GAMEPAD_Y, (left->buttons & HALO_XR_BUTTON_B) != 0);
|
||||
|
||||
+37
-4
@@ -961,6 +961,11 @@ static void hud_draw_players(
|
||||
long player_index = local_player_get_player_index(render.local_player_index);
|
||||
long team_index = player_get(player_index)->team_index;
|
||||
|
||||
#ifdef HALO_ANDROID
|
||||
/* (VR: over the heads, with the names: hud_draw_player_name) */
|
||||
if (halo_vr_names_apart())
|
||||
return;
|
||||
#endif
|
||||
if (player_index != NONE)
|
||||
{
|
||||
/* the native builds' sessions hold more than 16 players */
|
||||
@@ -1135,6 +1140,7 @@ static void hud_draw_player_name(
|
||||
long player_index,
|
||||
boolean ally,
|
||||
boolean indicator,
|
||||
boolean name_shown,
|
||||
real enemy_range,
|
||||
boolean vr_apart)
|
||||
{
|
||||
@@ -1176,7 +1182,7 @@ static void hud_draw_player_name(
|
||||
|
||||
point[0] = head_position.x;
|
||||
point[1] = head_position.y;
|
||||
point[2] = head_position.z + (indicator ? 0.15f : 0.0f);
|
||||
point[2] = head_position.z + (indicator ? 0.06f : 0.0f);
|
||||
slot = halo_vr_add_name(point);
|
||||
if (slot < 0)
|
||||
return;
|
||||
@@ -1185,7 +1191,31 @@ static void hud_draw_player_name(
|
||||
y = (short)(slot_bounds[3] - 4);
|
||||
/* (an ally's whole at any distance it is drawn at) */
|
||||
view_position.z = -1.0f;
|
||||
if (indicator)
|
||||
{
|
||||
/* (a teammate's triangle at the slot's foot, the name over it:
|
||||
the game's, drawn on the HUD, would hang before the eyes) */
|
||||
struct bitmap_data *bitmap = bitmap_group_get_bitmap_from_sequence(
|
||||
interface_get_tag_index(_interface_bitmap_multiplayer_hud), 0, 0);
|
||||
|
||||
if (bitmap && _texture_cache_bitmap_get_hardware_format(bitmap, FALSE, TRUE))
|
||||
{
|
||||
point2d tip;
|
||||
real_rectangle2d whole;
|
||||
|
||||
tip.x = x;
|
||||
tip.y = (short)(slot_bounds[3] - 2);
|
||||
whole.x0 = 0.0f;
|
||||
whole.x1 = 1.0f;
|
||||
whole.y0 = 0.0f;
|
||||
whole.y1 = 1.0f;
|
||||
interface_draw_bitmap(bitmap, &tip, &whole, 0.6f, 0.0f, 1.0f);
|
||||
y = (short)(tip.y - bitmap->registration_point.y * 0.6f);
|
||||
}
|
||||
}
|
||||
indicator = FALSE;
|
||||
if (!name_shown)
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -1271,7 +1301,8 @@ static void hud_draw_player_names_now(
|
||||
long team_index;
|
||||
real enemy_range;
|
||||
|
||||
if (setting == _player_names_none || player_index == NONE)
|
||||
/* (VR: the triangles over teammates go with the names, shown or not) */
|
||||
if ((setting == _player_names_none && !vr_apart) || player_index == NONE)
|
||||
return;
|
||||
team_index = player_get(player_index)->team_index;
|
||||
indicators = game_engine_display_team_indicators();
|
||||
@@ -1281,12 +1312,14 @@ static void hud_draw_player_names_now(
|
||||
{
|
||||
/* (allies as the game's triangles tell them: the same team) */
|
||||
boolean ally = player->team_index == team_index;
|
||||
boolean shown = !(setting == _player_names_none || (ally && setting == _player_names_enemies) ||
|
||||
(!ally && setting == _player_names_allies));
|
||||
|
||||
if (iterator.datum_index == player_index || player->unit_index == NONE)
|
||||
continue;
|
||||
if ((ally && setting == _player_names_enemies) || (!ally && setting == _player_names_allies))
|
||||
if (!shown && !(vr_apart && ally && indicators))
|
||||
continue;
|
||||
hud_draw_player_name(iterator.datum_index, ally, ally && indicators, enemy_range, vr_apart);
|
||||
hud_draw_player_name(iterator.datum_index, ally, ally && indicators, shown, enemy_range, vr_apart);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -5888,6 +5888,7 @@ reached). */
|
||||
|
||||
void platform_log(char const *format, ...);
|
||||
int p2p_join_code(char *text, int size);
|
||||
void halo_vr_pulse_pad_a(void);
|
||||
int p2p_join_with_code(char const *typed);
|
||||
int p2p_join_code_status(void);
|
||||
void p2p_join_code_clear_status(void);
|
||||
@@ -6195,6 +6196,13 @@ static boolean ui_join_code_take_pointer(
|
||||
press.type = _event_type_button;
|
||||
press.data.button.index = _gamepad_analog_button_a;
|
||||
press.data.button.value = 1;
|
||||
/* (the screen where controllers join by their A: a click is the
|
||||
pad's A, there, not a menu's) */
|
||||
if (pointer->left_clicks && y < 400 && ui_join_code_screen_active("4way_start2join_screen"))
|
||||
{
|
||||
halo_vr_pulse_pad_a();
|
||||
return TRUE;
|
||||
}
|
||||
if (ui_join_code_globals.panel_open)
|
||||
{
|
||||
if (x >= 48 && x < 592 && y >= 128 && y < 128 + ONLINE_PANEL_ROWS * 22)
|
||||
@@ -6379,13 +6387,16 @@ static void ui_join_code_render(
|
||||
if (ui_join_code_screen_active("server_list_screen"))
|
||||
{
|
||||
char const *status = NULL;
|
||||
real_argb_color hint_color = { 1.0f, 0.85f, 0.85f, 0.85f };
|
||||
|
||||
if (ui_join_code_globals.panel_open)
|
||||
{
|
||||
ui_join_code_render_panel();
|
||||
return;
|
||||
}
|
||||
ui_join_code_draw_line(372, "%x-button Online games: public ones, or join by a code", TRUE, FALSE);
|
||||
/* (in the key bar's free left, and under it: clear of the map's
|
||||
picture) */
|
||||
ui_join_code_draw_text(8, 200, 420, "%x-button Online / code", TRUE, 0, &hint_color);
|
||||
switch (p2p_join_code_status())
|
||||
{
|
||||
case _join_code_looking: status = "Looking for the game of that code..."; break;
|
||||
@@ -6408,7 +6419,7 @@ static void ui_join_code_render(
|
||||
}
|
||||
}
|
||||
if (status)
|
||||
ui_join_code_draw_line(392, status, FALSE, FALSE);
|
||||
ui_join_code_draw_line(452, status, FALSE, FALSE);
|
||||
}
|
||||
else if (ui_join_code_screen_active("connected_pregame_screen") && global_network_game_server_get())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user