Skip to content

Commit 5f11096

Browse files
authored
use pm->autocenter when drawing weapon lines (#7147)
In the weapon loadout screen, the model's visual center should be taken into account when calculating coordinates for weapon banks. Fixes #7145.
1 parent 6c96d12 commit 5f11096

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

code/missionui/missionweaponchoice.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,12 @@ void draw_3d_overhead_view(int model_num,
892892
gr_circle(bank_coords[x][0] + bank_prim_offset, bank_coords[x][1] + bank_y_offset, 5, resize_mode);
893893
for (y = 0; y < pm->gun_banks[x].num_slots; y++) {
894894
// Stuff
895-
vm_vec_unrotate(&subobj_pos, &pm->gun_banks[x].pnt[y], &object_orient);
895+
if (pm->flags & PM_FLAG_AUTOCEN) {
896+
vm_vec_sub(&subobj_pos, &pm->gun_banks[x].pnt[y], &pm->autocenter);
897+
vm_vec_unrotate(&subobj_pos, &subobj_pos, &object_orient);
898+
} else {
899+
vm_vec_unrotate(&subobj_pos, &pm->gun_banks[x].pnt[y], &object_orient);
900+
}
896901
g3_rotate_vertex(&draw_point, &subobj_pos);
897902
g3_project_vertex(&draw_point);
898903
int resize = resize_mode;
@@ -966,7 +971,12 @@ void draw_3d_overhead_view(int model_num,
966971
5,
967972
resize_mode);
968973
for (y = 0; y < pm->missile_banks[x].num_slots; y++) {
969-
vm_vec_unrotate(&subobj_pos, &pm->missile_banks[x].pnt[y], &object_orient);
974+
if (pm->flags & PM_FLAG_AUTOCEN) {
975+
vm_vec_sub(&subobj_pos, &pm->missile_banks[x].pnt[y], &pm->autocenter);
976+
vm_vec_unrotate(&subobj_pos, &subobj_pos, &object_orient);
977+
} else {
978+
vm_vec_unrotate(&subobj_pos, &pm->missile_banks[x].pnt[y], &object_orient);
979+
}
970980
g3_rotate_vertex(&draw_point, &subobj_pos);
971981
g3_project_vertex(&draw_point);
972982
int resize = resize_mode;

0 commit comments

Comments
 (0)