59- (void)setGuiToStickMapperScreen:(
unsigned)skip resetCurrentRow:(BOOL)resetCurrentRow
73 gui_screen = GUI_SCREEN_STICKMAPPER;
77 for (i = 0; i < stickCount; i++) {
78 NSString* stickNameForThisRow = [
NSString stringWithFormat:@"%@ %d %@", DESC(@"stickmapper-stick"), i + 1, [
stickList objectAtIndex:i]];
80 NSString* stickNameAdditional =
nil;
85 stringByAppendingString:@"..."];
90 stickNameAdditional = [
NSString stringWithFormat:@"%@ %d %@", DESC(@"stickmapper-stick"), j + 1, [
stickList objectAtIndex:j]];
95 stringByAppendingString:@"..."];
104 forRow:i + GUI_ROW_STICKNAME];
116 if (resetCurrentRow) {
119 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
130 if (waitingForStickCallback) {
131 if ([gameView isDown:27]) {
134 DESC(@"stickmapper-set-aborted"), nil]
136 waitingForStickCallback = NO;
144 BOOL selectKeyPress = ([
self checkKeyPress:n_key_gui_select] || joyButtonState[BUTTON_GUISELECT] || [
gameView isDown:gvMouseDoubleClick]);
152 if ([key hasPrefix:
@"Index:"])
153 selFunctionIdx = [[[
key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
157 if (selectKeyPress) {
158 if ([key hasPrefix:
@"More:"]) {
159 int from_function = [[[
key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
160 if (from_function < 0)
164 if ([[
UNIVERSE gui] selectedRow] < 0)
165 [[UNIVERSE gui] setSelectedRow:GUI_ROW_FUNCSTART];
166 if (from_function == 0)
167 [[UNIVERSE gui] setSelectedRow:GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
171 NSDictionary* entry = [
stickFunctions objectAtIndex:selFunctionIdx];
172 int hw = [(
NSNumber*)[
entry objectForKey:KEY_ALLOWABLE] intValue];
178 NSString* instructions;
181 instructions =
DESC(
@"stickmapper-set-help-text-axis");
184 instructions =
DESC(
@"stickmapper-set-help-text-button");
187 instructions =
DESC(
@"stickmapper-set-help-text-either");
190 waitingForStickCallback = YES;
193 if ([gameView isDown:
'u']) {
194 if (selFunctionIdx >= 0)
201- (void)updateFunction:(NSDictionary*)hwDict
204 waitingForStickCallback = NO;
207 if (gui_screen != GUI_SCREEN_STICKMAPPER) {
208 OOLog(
@"joystick.configure.error",
@"%s called when not on stick mapper screen.", __PRETTY_FUNCTION__);
213 NSDictionary* entry = [
stickFunctions objectAtIndex:selFunctionIdx];
215 function = [
entry oo_intForKey:KEY_AXISFN];
220#if OO_FOV_INFLIGHT_CONTROL_ENABLED
221 if (
function == AXIS_FIELD_OF_VIEW) {
235 function = [
entry oo_intForKey:KEY_BUTTONFN];
239#if OO_FOV_INFLIGHT_CONTROL_ENABLED
240 if (
function == BUTTON_INC_FIELD_OF_VIEW ||
function == BUTTON_DEC_FIELD_OF_VIEW) {
252 if (
function >= 10000) {
255 if (
function >= 10000) {
265 [
defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
363 skip:(NSUInteger)skip
369 DESC(@"stickmapper-column-function"), DESC(@"stickmapper-column-assigned-to"), DESC(@"stickmapper-column-type"), nil]
372 if (!stickFunctions) {
380 NSInteger n_rows, start_row, previous = 0;
382 if (skip >= n_functions)
383 skip = n_functions - 1;
403 if (n_functions > 0) {
410 for (i = 0; i < (n_functions - skip) && (
int)i < n_rows; i++) {
413 NSString* header = [
entry objectForKey:KEY_HEADER];
417 NSString* allowedThings;
418 NSString* assignment;
419 NSString* axFuncKey = [
entry oo_stringForKey:KEY_AXISFN];
420 NSString* butFuncKey = [
entry oo_stringForKey:KEY_BUTTONFN];
421 int allowable = [
entry oo_intForKey:KEY_ALLOWABLE];
424 allowedThings =
DESC(
@"stickmapper-allowed-axis");
429 allowedThings =
DESC(
@"stickmapper-allowed-button");
451 allowedThings =
DESC(
@"stickmapper-allowed-both");
469 if (assignment ==
nil) {
474 [
entry objectForKey:KEY_GUIDESC], assignment, allowedThings, nil]
480 if (i < n_functions - skip) {
491- (NSString*)describeStickDict:(NSDictionary*)stickDict
493 NSString* desc =
nil;
500 if ([(NSNumber*)[stickDict objectForKey:
STICK_ISAXIS] boolValue]) {
501 desc = [
NSString stringWithFormat:@"%@ %d %@ %d",
502 DESC(@"stickmapper-stick"), stickNumber + 1, DESC(@"stickmapper-axis"), thingNumber + 1];
504 NSString* dir[] = {
DESC(
@"stickmapper-hat-up"),
DESC(
@"stickmapper-hat-right"),
DESC(
@"stickmapper-hat-down"),
DESC(
@"stickmapper-hat-left") };
505 desc = [
NSString stringWithFormat:@"%@ %d %@ %d %@",
506 DESC(@"stickmapper-stick"), stickNumber + 1, DESC(@"stickmapper-hat"), (thingNumber - MAX_REAL_BUTTONS) / 4 + 1,
509 desc = [
NSString stringWithFormat:@"%@ %d %@ %d",
510 DESC(@"stickmapper-stick"), stickNumber + 1, DESC(@"stickmapper-button"), thingNumber + 1];
544 butfn:STICK_NOFUNCTION]];
549 butfn:STICK_NOFUNCTION]];
554 butfn:STICK_NOFUNCTION]];
559 butfn:BUTTON_INCTHRUST]];
564 butfn:BUTTON_DECTHRUST]];
569 butfn:BUTTON_FUELINJECT]];
574 butfn:BUTTON_HYPERSPEED]];
579 butfn:BUTTON_HYPERDRIVE]];
584 butfn:BUTTON_GALACTICDRIVE]];
590 butfn:BUTTON_PRECISION]];
598 butfn:BUTTON_COMPASSMODE]];
603 butfn:BUTTON_COMPASSMODE_PREV]];
608 butfn:BUTTON_SCANNERZOOM]];
613 butfn:BUTTON_SCANNERUNZOOM]];
618 butfn:BUTTON_VIEWFORWARD]];
623 butfn:BUTTON_VIEWAFT]];
628 butfn:BUTTON_VIEWPORT]];
633 butfn:BUTTON_VIEWSTARBOARD]];
638 butfn:BUTTON_EXTVIEWCYCLE]];
648 butfn:BUTTON_DOCKINGCLEARANCE]];
653 butfn:BUTTON_DOCKCPU]];
658 butfn:BUTTON_DOCKCPUFAST]];
663 butfn:BUTTON_DOCKINGMUSIC]];
671 butfn:BUTTON_WEAPONSONLINETOGGLE]];
681 butfn:BUTTON_LAUNCHMISSILE]];
686 butfn:BUTTON_ARMMISSILE]];
691 butfn:BUTTON_UNARM]];
696 butfn:BUTTON_TARGETINCOMINGMISSILE]];
701 butfn:BUTTON_CYCLEMISSILE]];
706 butfn:BUTTON_NEXTTARGET]];
711 butfn:BUTTON_PREVTARGET]];
724 butfn:BUTTON_JETTISON]];
729 butfn:BUTTON_ROTATECARGO]];
734 butfn:BUTTON_ESCAPE]];
742 butfn:BUTTON_MFDSELECTNEXT]];
747 butfn:BUTTON_MFDSELECTPREV]];
752 butfn:BUTTON_MFDCYCLENEXT]];
757 butfn:BUTTON_MFDCYCLEPREV]];
762 butfn:BUTTON_PRIMEEQUIPMENT]];
767 butfn:BUTTON_PRIMEEQUIPMENT]];
772 butfn:BUTTON_ACTIVATEEQUIPMENT]];
777 butfn:BUTTON_MODEEQUIPMENT]];
782 butfn:BUTTON_CLOAK]];
787 butfn:BUTTON_ENERGYBOMB]];
794 butfn:BUTTON_GUILEFT]];
799 butfn:BUTTON_GUIRIGHT]];
804 butfn:BUTTON_GUIUP]];
809 butfn:BUTTON_GUIDOWN]];
814 butfn:BUTTON_GUIPAGEUP]];
819 butfn:BUTTON_GUIPAGEDOWN]];
824 butfn:BUTTON_GUISELECT]];
832 butfn:BUTTON_SNAPSHOT]];
837 butfn:BUTTON_PAUSE]];
842 butfn:BUTTON_TOGGLEHUD]];
847 butfn:BUTTON_COMMSLOG]];
848#if OO_FOV_INFLIGHT_CONTROL_ENABLED
853 butfn:BUTTON_INC_FIELD_OF_VIEW]];
858 butfn:BUTTON_DEC_FIELD_OF_VIEW]];
860 if ([customEquipActivation
count] > 0) {