used in weapon selection: returns new slot.
| 1077 | } |
| 1078 | // used in weapon selection: returns new slot. |
| 1079 | int weapon_select_dialog(int wpn, bool is_secondary) { |
| 1080 | newuiTiledWindow wnd; |
| 1081 | newuiListBox *lbox; |
| 1082 | newuiSheet *sheet; |
| 1083 | int res, i; |
| 1084 | uint16_t retval; |
| 1085 | wpn &= (~WPNSEL_SKIP); |
| 1086 | wnd.Create(NULL, 0, 0, 320, 288); |
| 1087 | sheet = wnd.GetSheet(); |
| 1088 | sheet->NewGroup(NULL, 116, 210, NEWUI_ALIGN_HORIZ); |
| 1089 | sheet->AddButton(TXT_OK, UID_OK); |
| 1090 | sheet->AddButton(TXT_CANCEL, UID_CANCEL); |
| 1091 | sheet->NewGroup(NULL, 0, 0); |
| 1092 | sheet->AddText(TXT_WPNCFGHELP3); |
| 1093 | sheet->AddText(TXT(Static_weapon_names_msg[wpn])); |
| 1094 | sheet->NewGroup(NULL, 0, 40); |
| 1095 | lbox = sheet->AddListBox(192, 160, UID_WPNLIST, UILB_NOSORT); |
| 1096 | // add primaries or secondaries. |
| 1097 | for (i = 0; i < 10; i++) { |
| 1098 | int wpnidx; |
| 1099 | char str[64]; |
| 1100 | wpnidx = is_secondary ? GetAutoSelectSecondaryWpnIdx(i) : GetAutoSelectPrimaryWpnIdx(i); |
| 1101 | if (wpnidx != WPNSEL_INVALID) { |
| 1102 | if (wpnidx & WPNSEL_SKIP) { |
| 1103 | wpnidx &= (~WPNSEL_SKIP); |
| 1104 | snprintf(str, sizeof(str), TXT_WPNSELBTN, TXT(Static_weapon_names_msg[wpnidx])); |
| 1105 | } else { |
| 1106 | snprintf(str, sizeof(str), "%s", TXT(Static_weapon_names_msg[wpnidx])); |
| 1107 | } |
| 1108 | lbox->AddItem(str); |
| 1109 | } else { |
| 1110 | lbox->AddItem("ERR-WPN"); |
| 1111 | } |
| 1112 | } |
| 1113 | wnd.Open(); |
| 1114 | res = wnd.DoUI(); |
| 1115 | wnd.Close(); |
| 1116 | switch (res) { |
| 1117 | case UID_WPNLIST: |
| 1118 | case UID_OK: |
| 1119 | retval = lbox->GetCurrentIndex(); |
| 1120 | break; |
| 1121 | default: |
| 1122 | retval = -1; |
| 1123 | } |
| 1124 | wnd.Destroy(); |
| 1125 | |
| 1126 | return retval; |
| 1127 | } |
| 1128 | void joystick_calibration() { |
| 1129 | } |
| 1130 | void joystick_settings_dialog() { |
nothing calls this directly
no test coverage detected