61- (void) setGuiToStickMapperScreen:(
unsigned)skip resetCurrentRow: (BOOL) resetCurrentRow
75 gui_screen = GUI_SCREEN_STICKMAPPER;
79 for(i=0; i < stickCount; i++)
81 NSString *stickNameForThisRow = [
NSString stringWithFormat: @"Stick %d %@", i+1, [
stickList objectAtIndex: i]];
83 NSString *stickNameAdditional =
nil;
89 stringByAppendingString:@"..."];
95 stickNameAdditional = [
NSString stringWithFormat: @"Stick %d %@", j+1, [
stickList objectAtIndex: j]];
101 stringByAppendingString:@"..."];
110 forRow:i + GUI_ROW_STICKNAME];
117 [
gui setArray:[
NSArray arrayWithObject:@"Select a function and press Enter to modify or 'u' to unset."]
120 [
gui setText:@"Space to return to previous screen."
forRow:GUI_ROW_INSTRUCT+1
align:GUI_ALIGN_CENTER];
126 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
139 if(waitingForStickCallback)
141 if([gameView isDown: 27])
145 @"Function setting aborted.", nil]
146 forRow: GUI_ROW_INSTRUCT];
147 waitingForStickCallback=NO;
163 if ([key hasPrefix:
@"Index:"])
164 selFunctionIdx=[[[
key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
168 if([gameView isDown: 13])
170 if ([key hasPrefix:
@"More:"])
172 int from_function = [[[
key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
173 if (from_function < 0) from_function = 0;
176 if ([[
UNIVERSE gui] selectedRow] < 0)
177 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
178 if (from_function == 0)
179 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
183 NSDictionary *entry=[
stickFunctions objectAtIndex: selFunctionIdx];
184 int hw=[(
NSNumber *)[
entry objectForKey: KEY_ALLOWABLE] intValue];
190 NSString *instructions;
194 instructions =
@"Fully deflect the axis you want to use for this function. Esc aborts.";
197 instructions =
@"Press the button you want to use for this function. Esc aborts.";
200 instructions =
@"Press the button or deflect the axis you want to use for this function.";
203 waitingForStickCallback=YES;
206 if([gameView isDown:
'u'])
215- (void) updateFunction: (NSDictionary *)hwDict
218 waitingForStickCallback = NO;
221 if(gui_screen != GUI_SCREEN_STICKMAPPER)
223 OOLog(
@"joystick.configure.error",
@"%s called when not on stick mapper screen.", __PRETTY_FUNCTION__);
229 NSDictionary *entry = [
stickFunctions objectAtIndex:selFunctionIdx];
232 function=[
entry oo_intForKey: KEY_AXISFN];
238#if OO_FOV_INFLIGHT_CONTROL_ENABLED
239 if (
function == AXIS_FIELD_OF_VIEW)
258 function = [
entry oo_intForKey:KEY_BUTTONFN];
263#if OO_FOV_INFLIGHT_CONTROL_ENABLED
264 if (
function == BUTTON_INC_FIELD_OF_VIEW ||
function == BUTTON_DEC_FIELD_OF_VIEW)
279 if (
function >= 10000)
283 if (
function >= 10000)
292 [
defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
395 skip:(NSUInteger)skip
401 @"Function", @"Assigned to", @"Type", nil]
412 NSInteger n_rows, start_row, previous = 0;
414 if (skip >= n_functions)
415 skip = n_functions - 1;
448 for(i=0; i < (n_functions - skip) && (
int)i < n_rows; i++)
452 NSString *header = [
entry objectForKey:KEY_HEADER];
458 NSString *allowedThings;
459 NSString *assignment;
460 NSString *axFuncKey = [
entry oo_stringForKey:KEY_AXISFN];
461 NSString *butFuncKey = [
entry oo_stringForKey:KEY_BUTTONFN];
462 int allowable = [
entry oo_intForKey:KEY_ALLOWABLE];
466 allowedThings=
@"Axis";
471 allowedThings=
@"Button";
492 allowedThings=
@"Axis/Button";
503 if (assignment ==
nil)
509 [
entry objectForKey: KEY_GUIDESC], assignment, allowedThings, nil]
515 if (i < n_functions - skip)
529- (NSString *) describeStickDict: (NSDictionary *)stickDict
539 if([(NSNumber *)[stickDict objectForKey:
STICK_ISAXIS] boolValue])
541 desc=[
NSString stringWithFormat: @"Stick %d axis %d",
542 stickNumber+1, thingNumber+1];
546 static const char dir[][6] = {
"up",
"right",
"down",
"left" };
547 desc=[
NSString stringWithFormat: @"Stick %d hat %d %s",
548 stickNumber+1, (thingNumber - MAX_REAL_BUTTONS) / 4 + 1,
553 desc=[
NSString stringWithFormat: @"Stick %d button %d",
554 stickNumber+1, thingNumber+1];
591 butfn:STICK_NOFUNCTION]];
596 butfn:STICK_NOFUNCTION]];
601 butfn:STICK_NOFUNCTION]];
606 butfn:BUTTON_INCTHRUST]];
611 butfn:BUTTON_DECTHRUST]];
616 butfn:BUTTON_FUELINJECT]];
621 butfn:BUTTON_HYPERSPEED]];
626 butfn:BUTTON_HYPERDRIVE]];
631 butfn:BUTTON_GALACTICDRIVE]];
637 butfn:BUTTON_PRECISION]];
645 butfn:BUTTON_COMPASSMODE]];
650 butfn:BUTTON_COMPASSMODE_PREV]];
655 butfn:BUTTON_SCANNERZOOM]];
660 butfn:BUTTON_SCANNERUNZOOM]];
665 butfn:BUTTON_VIEWFORWARD]];
670 butfn:BUTTON_VIEWAFT]];
675 butfn:BUTTON_VIEWPORT]];
680 butfn:BUTTON_VIEWSTARBOARD]];
685 butfn:BUTTON_EXTVIEWCYCLE]];
695 butfn:BUTTON_DOCKINGCLEARANCE]];
700 butfn:BUTTON_DOCKCPU]];
705 butfn:BUTTON_DOCKCPUFAST]];
710 butfn:BUTTON_DOCKINGMUSIC]];
718 butfn:BUTTON_WEAPONSONLINETOGGLE]];
728 butfn:BUTTON_LAUNCHMISSILE]];
733 butfn:BUTTON_ARMMISSILE]];
738 butfn:BUTTON_UNARM]];
743 butfn:BUTTON_TARGETINCOMINGMISSILE]];
748 butfn:BUTTON_CYCLEMISSILE]];
753 butfn:BUTTON_NEXTTARGET]];
758 butfn:BUTTON_PREVTARGET]];
771 butfn:BUTTON_JETTISON]];
776 butfn:BUTTON_ROTATECARGO]];
781 butfn:BUTTON_ESCAPE]];
789 butfn:BUTTON_MFDSELECTNEXT]];
794 butfn:BUTTON_MFDSELECTPREV]];
799 butfn:BUTTON_MFDCYCLENEXT]];
804 butfn:BUTTON_MFDCYCLEPREV]];
809 butfn:BUTTON_PRIMEEQUIPMENT]];
814 butfn:BUTTON_PRIMEEQUIPMENT]];
819 butfn:BUTTON_ACTIVATEEQUIPMENT]];
824 butfn:BUTTON_MODEEQUIPMENT]];
829 butfn:BUTTON_CLOAK]];
834 butfn:BUTTON_ENERGYBOMB]];
842 butfn:BUTTON_SNAPSHOT]];
847 butfn:BUTTON_PAUSE]];
852 butfn:BUTTON_TOGGLEHUD]];
857 butfn:BUTTON_COMMSLOG]];
858#if OO_FOV_INFLIGHT_CONTROL_ENABLED
863 butfn:BUTTON_INC_FIELD_OF_VIEW]];
868 butfn:BUTTON_DEC_FIELD_OF_VIEW]];
870 if ([customEquipActivation
count] > 0) {