mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-18 01:00:26 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8034d37fd | ||
|
|
23d14319a7 | ||
|
|
ff5b91f120 |
No files matched your search
@@ -140,6 +140,9 @@ out (halo_vr_scope_pass). */
|
||||
int halo_vr_scope(short local_player_index, float magnification, float position[3], float forward[3], float up[3],
|
||||
float *vertical_field_of_view);
|
||||
int halo_vr_scope_pass(void);
|
||||
/* how much higher than a rifle's the weapon in hand has its scope's disc
|
||||
(metres; render.c, before halo_vr_scope) */
|
||||
void halo_vr_set_scope_raise(float metres);
|
||||
void halo_vr_capture_scope(float left, float top, float right, float bottom);
|
||||
/* where the weapon's gun node is as drawn, at the ready (world units;
|
||||
first_person_weapons.c, each frame): shots, the crosshair and the laser
|
||||
|
||||
+10
-1
@@ -1957,6 +1957,14 @@ The world around it stays as it is (zooming the whole view sickens). */
|
||||
#define SCOPE_ABOVE_HAND 0.07f
|
||||
#define SCOPE_AHEAD_OF_HAND 0.22f
|
||||
|
||||
/* (the weapon in hand's: halo_vr_set_scope_raise) */
|
||||
static float scope_raise;
|
||||
|
||||
void halo_vr_set_scope_raise(float metres)
|
||||
{
|
||||
scope_raise = metres;
|
||||
}
|
||||
|
||||
int halo_vr_scope(short local_player_index, float magnification, float position[3], float forward[3], float up[3],
|
||||
float *vertical_field_of_view)
|
||||
{
|
||||
@@ -1975,7 +1983,7 @@ int halo_vr_scope(short local_player_index, float magnification, float position[
|
||||
game_to_local(right, local_right);
|
||||
for (axis = 0; axis < 3; axis++)
|
||||
{
|
||||
vr.scope_pose.position[axis] = hand->aim.position[axis] + local_up[axis] * SCOPE_ABOVE_HAND +
|
||||
vr.scope_pose.position[axis] = hand->aim.position[axis] + local_up[axis] * (SCOPE_ABOVE_HAND + scope_raise) +
|
||||
local_forward[axis] * SCOPE_AHEAD_OF_HAND;
|
||||
}
|
||||
if (barrel_known())
|
||||
@@ -2167,6 +2175,7 @@ int halo_vr_scope(short local_player_index, float magnification, float position[
|
||||
return 0;
|
||||
}
|
||||
int halo_vr_scope_pass(void) { return 0; }
|
||||
void halo_vr_set_scope_raise(float metres) { (void)metres; }
|
||||
void halo_vr_capture_scope(float left, float top, float right, float bottom)
|
||||
{
|
||||
(void)left; (void)top; (void)right; (void)bottom;
|
||||
|
||||
@@ -746,6 +746,16 @@ static void render_vr_scope(
|
||||
if (zoom_level == NONE || player_index == NONE || player_get(player_index)->unit_index == NONE)
|
||||
return;
|
||||
magnification = unit_get_zoom_magnification(player_get(player_index)->unit_index, zoom_level);
|
||||
{
|
||||
/* (a weapon whose body stands higher over the hand than a rifle's
|
||||
has its scope's disc higher: the rocket launcher's tube) */
|
||||
struct unit_datum *unit = unit_get(player_get(player_index)->unit_index);
|
||||
long weapon_index = unit->unit.current_weapon_index >= 0 ?
|
||||
unit->unit.weapon_object_indices[unit->unit.current_weapon_index] : NONE;
|
||||
char const *name = weapon_index != NONE ? tag_get_name(object_get(weapon_index)->definition_index) : NULL;
|
||||
|
||||
halo_vr_set_scope_raise(name && strstr(name, "rocket launcher") ? 0.18f : 0.0f);
|
||||
}
|
||||
if (!halo_vr_scope(window->local_player_index, magnification, position, forward, up, &vertical_field_of_view))
|
||||
return;
|
||||
scope_window = *window;
|
||||
|
||||
Reference in new issue
Block a user