Skip to content

Commit 5de705d

Browse files
committed
swars: Fixed few misses in menu components positioning
1 parent 6415bd3 commit 5de705d

7 files changed

Lines changed: 51 additions & 46 deletions

File tree

src/fecryo.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,14 +1713,21 @@ void init_cryo_screen_boxes(void)
17131713
space_h = 5;
17141714
cryo_offer_cancel_button.X = cryo_cybmod_list_box.X + cryo_cybmod_list_box.Width - cryo_offer_cancel_button.Width - space_w;
17151715
cryo_offer_cancel_button.Y = cryo_cybmod_list_box.Y + cryo_cybmod_list_box.Height - cryo_offer_cancel_button.Height - space_h;
1716+
// No need to update equip_cost_box - that is done in switch_shared_equip_screen_buttons_to_cybmod()
17161717
}
17171718

17181719
void switch_shared_equip_screen_buttons_to_cybmod(void)
17191720
{
1721+
short space_w, space_h;
1722+
1723+
space_w = 5;
1724+
space_h = 5;
17201725
set_heading_box_text(gui_strings[369]);
1721-
equip_cost_box.X = cryo_cybmod_list_box.X + 5;
1722-
equip_cost_box.Width = cryo_cybmod_list_box.Width - 10;
1723-
equip_cost_box.Y = 383;
1726+
1727+
equip_cost_box.X = cryo_cybmod_list_box.X + space_w;
1728+
equip_cost_box.Width = cryo_cybmod_list_box.Width - 2 * space_h;
1729+
equip_cost_box.Y = cryo_offer_cancel_button.Y - space_h - equip_cost_box.Height;
1730+
17241731
equip_name_box.Text = cybmod_name_text;
17251732
equip_all_agents_button.CallBackFn = ac_do_cryo_all_agents_set;
17261733

src/fedebrief.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -682,17 +682,7 @@ ubyte show_mission_people_stats(struct ScreenBox *box)
682682

683683
void init_debrief_screen_boxes(void)
684684
{
685-
ScrCoord scr_h, start_x, start_y;
686-
short space_w, space_h, border;
687-
688-
// Border value represents how much the box background goes
689-
// out of the box area.
690-
border = 3;
691-
#ifdef EXPERIMENTAL_MENU_CENTER_H
692-
scr_h = global_apps_bar_box.Y;
693-
#else
694-
scr_h = 432;
695-
#endif
685+
ScrCoord start_x, start_y;
696686

697687
init_screen_box(&debrief_mission_box, 7u, 72u, 518u, 172, 6);
698688
debrief_mission_box.SpecialDrawFn = show_mission_stats;
@@ -702,22 +692,17 @@ void init_debrief_screen_boxes(void)
702692

703693
// Reposition the components to current resolution
704694

695+
// For this screen, we will just align to other pre-positioned boxes;
696+
// No need to compute positions from scratch
705697
start_x = heading_box.X;
706-
// On the X axis, we're going for aligning below heading box, to both left and right
707-
space_w = heading_box.Width - debrief_mission_box.Width - world_city_info_box.Width;
708-
709-
start_y = heading_box.Y + heading_box.Height;
710-
// On the top, we're aligning to spilled border of previous box; same goes inside.
711-
// But on the bottom, we're aligning to hard border, without spilling. To compensate
712-
// for that, add pixels for such border to the space.
713-
space_h = scr_h - start_y - world_city_info_box.Height + border;
698+
start_y = world_city_info_box.Y;
714699

715700
// Expect world_city_info_box to be already set
716701
debrief_mission_box.X = start_x;
717-
debrief_mission_box.Y = world_city_info_box.Y;
702+
debrief_mission_box.Y = start_y;
718703

719704
debrief_people_box.X = start_x;
720-
debrief_people_box.Y = world_city_info_box.Y + world_city_info_box.Height - debrief_people_box.Height;
705+
debrief_people_box.Y = start_y + world_city_info_box.Height - debrief_people_box.Height;
721706
}
722707

723708
void reset_debrief_screen_boxes_flags(void)

src/feequip.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -812,19 +812,6 @@ TbBool input_display_box_content_wep(struct ScreenTextBox *p_box)
812812
return false;
813813
}
814814

815-
void switch_shared_equip_screen_buttons_to_equip(void)
816-
{
817-
set_heading_box_text(gui_strings[370]);
818-
refresh_equip_list = 1;
819-
equip_cost_box.X = equip_offer_buy_button.X + equip_offer_buy_button.Width + 4;
820-
equip_cost_box.Width = equip_list_box.Width - 2 - equip_offer_buy_button.Width - 14;
821-
equip_cost_box.Y = 404;
822-
equip_all_agents_button.CallBackFn = ac_do_equip_all_agents_set;
823-
824-
equip_display_box_redraw(&equip_display_box);
825-
equip_name_box_redraw(&equip_name_box);
826-
}
827-
828815
/** Determines if buy or sell should be available in the equip weapon offer.
829816
*
830817
* @return Gives 0 if button unavailable, 1 for buy, 2 for sell.
@@ -1339,10 +1326,26 @@ void init_equip_screen_boxes(void)
13391326
space_h = 5;
13401327
equip_offer_buy_button.X = equip_display_box.X + space_w;
13411328
equip_offer_buy_button.Y = equip_display_box.Y + equip_display_box.Height - space_h - equip_offer_buy_button.Height;
1329+
// No need to update equip_cost_box - that is done in switch_shared_equip_screen_buttons_to_equip()
1330+
}
1331+
1332+
void switch_shared_equip_screen_buttons_to_equip(void)
1333+
{
1334+
short space_w, space_h;
1335+
1336+
space_w = 5;
1337+
space_h = 5;
1338+
set_heading_box_text(gui_strings[370]);
1339+
refresh_equip_list = 1;
13421340

1343-
equip_cost_box.Width = equip_list_box.Width - equip_offer_buy_button.Width - 3 * space_w - 1;
1344-
equip_cost_box.X = equip_offer_buy_button.X + equip_offer_buy_button.Width - (space_w - 1) - equip_cost_box.Width;
1341+
equip_cost_box.Width = equip_display_box.Width - equip_offer_buy_button.Width - 3 * space_w - 1;
1342+
equip_cost_box.X = equip_display_box.X + equip_display_box.Width - (space_w - 1) - equip_cost_box.Width;
13451343
equip_cost_box.Y = equip_display_box.Y + equip_display_box.Height - space_h - equip_cost_box.Height;
1344+
1345+
equip_all_agents_button.CallBackFn = ac_do_equip_all_agents_set;
1346+
1347+
equip_display_box_redraw(&equip_display_box);
1348+
equip_name_box_redraw(&equip_name_box);
13461349
}
13471350

13481351
void init_equip_screen_shapes(void)

src/fenet.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ void init_net_screen_boxes(void)
541541
{
542542
ScrCoord scr_w, scr_h, start_x, start_y;
543543
short space_w, space_h, border;
544-
short content_boxes_height;
545544

546545
// Border value represents how much the box background goes
547546
// out of the box area.

src/feoptions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ void init_options_gfx_screen_boxes(void)
694694
options_gfx_buttons[i].Width) / 2;
695695
options_gfx_buttons[i].X = options_gfx_box.X +
696696
val + 9;
697+
options_gfx_buttons[i].Y = options_gfx_buttons[12].Y + (i - 12) * 36;
697698
}
698699
}
699700

src/festorage.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ void init_storage_screen_boxes(void)
108108
// There is one box only to position, so space goes into two parts - before and after.
109109
storage_slots_box.Y = start_y + space_h / 2;
110110

111-
storage_LOAD_button.X = storage_slots_box.X + 6;
112-
storage_SAVE_button.X = storage_LOAD_button.X + storage_LOAD_button.Width + 4;
111+
space_w = 5;
112+
space_h = 5;
113+
storage_LOAD_button.X = storage_slots_box.X + (space_w + 1);
114+
storage_LOAD_button.Y = storage_slots_box.Y + storage_slots_box.Height - space_w - storage_LOAD_button.Height;
115+
storage_SAVE_button.X = storage_LOAD_button.X + storage_LOAD_button.Width + (space_w - 1);
116+
storage_SAVE_button.Y = storage_LOAD_button.Y;
113117
storage_NEW_MORTAL_button.X = storage_slots_box.X + storage_slots_box.Width -
114-
storage_NEW_MORTAL_button.Width - 6;
118+
storage_NEW_MORTAL_button.Width - (space_w + 1);
119+
storage_NEW_MORTAL_button.Y = storage_LOAD_button.Y;
115120
}
116121

117122
void reset_storage_screen_boxes_flags(void)

src/feworld.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,15 @@ void init_world_screen_boxes(void)
695695
world_landmap_box.Y = world_city_info_box.Y;
696696
world_city_info_box.X = world_landmap_box.X + world_landmap_box.Width + space_w;
697697

698-
world_info_ACCEPT_button.X = world_city_info_box.X
699-
+ ((world_city_info_box.Width - world_info_ACCEPT_button.Width) >> 1);
698+
space_h = 5;
700699
world_info_CANCEL_button.X = world_city_info_box.X
701-
+ ((world_city_info_box.Width - world_info_CANCEL_button.Width) >> 1);
700+
+ ((world_city_info_box.Width - world_info_CANCEL_button.Width) >> 1);
701+
world_info_CANCEL_button.Y = world_city_info_box.Y + world_city_info_box.Height
702+
- space_h - world_info_CANCEL_button.Height;
703+
world_info_ACCEPT_button.X = world_city_info_box.X
704+
+ ((world_city_info_box.Width - world_info_ACCEPT_button.Width) >> 1);
705+
world_info_ACCEPT_button.Y = world_info_CANCEL_button.Y
706+
- space_h - world_info_ACCEPT_button.Height;
702707
}
703708

704709
void reset_world_screen_boxes_flags(void)

0 commit comments

Comments
 (0)