2035 :(double) delta_t
2036{
2038 BOOL moving = NO;
2039 BOOL dragging = NO;
2040 double cursor_speed = ([gameView
isCtrlDown] ? 20.0 : 10.0)* chart_zoom;
2044
2045
2046 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2047 {
2049 }
2050 else if (gui_screen == GUI_SCREEN_SAVE)
2051 {
2053 }
2054 else if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry)
2055 {
2057 }
2058 else if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY)
2059 {
2061 }
2062#if 0
2063
2064
2065 else if (gui_screen == GUI_SCREEN_OXZMANAGER && [[
OOOXZManager sharedManager] isAcceptingTextInput])
2066 {
2068 }
2069#endif
2070 else
2071 {
2073
2074
2075 if (afterburner_engaged && ![self checkKeyPress:n_key_inject_fuel])
2076 {
2077 afterburner_engaged = NO;
2078 }
2079
2080 }
2081
2082 switch (gui_screen)
2083 {
2084 case GUI_SCREEN_LONG_RANGE_CHART:
2085
2086 if ([self status] != STATUS_WITCHSPACE_COUNTDOWN)
2087 {
2088 if ([[gameView typedString] length] > 0)
2089 {
2090 planetSearchString = [[[gameView
typedString] lowercaseString] retain];
2091 NSPoint search_coords = [UNIVERSE findSystemCoordinatesWithPrefix:planetSearchString];
2092 if ((search_coords.x >= 0.0)&&(search_coords.y >= 0.0))
2093 {
2094
2095 if ([planetSearchString length] == 1) [[UNIVERSE gui] targetNextFoundSystem:0];
2096
2097
2098 [self targetNewSystem:0 whileTyping:YES];
2099 }
2100 else
2101 {
2102 found_system_id = -1;
2103 [self clearPlanetSearchString];
2104 }
2105 }
2106 else
2107 {
2109 {
2110 found_system_id = -1;
2111 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
2112 }
2113 if (planetSearchString) [planetSearchString release];
2114 planetSearchString =
nil;
2115 }
2116
2119 }
2120
2121 case GUI_SCREEN_SHORT_RANGE_CHART:
2122
2123 if ([self checkKeyPress:n_key_chart_highlight])
2124 {
2126 {
2128 if (
mode != OOLRC_MODE_TECHLEVEL)
2129 {
2130 [self setLongRangeChartMode:mode+1];
2131 }
2132 else
2133 {
2134 [self setLongRangeChartMode:OOLRC_MODE_SUNCOLOR];
2135 }
2136 [self doScriptEvent:OOJSID("chartHighlightModeChanged") withArgument:OOStringFromLongRangeChartMode([self longRangeChartMode])];
2137 }
2139 }
2140 else
2141 {
2143 }
2144
2146 {
2148 {
2149 show_info_flag = !show_info_flag;
2151 }
2152 }
2153 else
2154 {
2156 }
2157
2158 if ([self status] != STATUS_WITCHSPACE_COUNTDOWN)
2159 {
2160 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
2161 {
2162 if ([
self checkKeyPress:n_key_advanced_nav_array_next] || [
self checkKeyPress:n_key_advanced_nav_array_previous])
2163 {
2165 {
2166 if ([self checkKeyPress:n_key_advanced_nav_array_previous])
2167 {
2168 switch (ANA_mode)
2169 {
2173 }
2174 }
2175 else
2176 {
2177 switch (ANA_mode)
2178 {
2182 }
2183 }
2185 {
2186 [self setInfoSystemID: target_system_id moveChart: NO];
2187 }
2188 }
2190 }
2191 else
2192 {
2194 }
2195 }
2196 else
2197 {
2199 }
2200
2202 {
2205 [self noteGUIWillChangeTo:GUI_SCREEN_SYSTEM_DATA];
2206 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
2207 [self setGuiToSystemDataScreen];
2208 break;
2209 }
2211 {
2217 {
2218 NSPoint centre = [self adjusted_chart_centre];
2221 chart_focus_coordinates.x = OOClamp_0_max_f(centre.x + (maus.x *
MAIN_GUI_PIXEL_WIDTH) / hscale, 256.0);
2222 chart_focus_coordinates.y = OOClamp_0_max_f(centre.y + (maus.y *
MAIN_GUI_PIXEL_HEIGHT + vadjust) / vscale, 256.0);
2223 target_chart_focus = chart_focus_coordinates;
2224 }
2227 {
2230 target_chart_centre = chart_centre_coordinates;
2231 dragging = YES;
2232 }
2233 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2236 }
2238 {
2242 {
2243 cursor_coordinates = chart_focus_coordinates;
2244 moving = YES;
2245 }
2246 else
2247 {
2248 dragging = YES;
2249 }
2251 }
2252 if ([self checkKeyPress:n_key_map_home])
2253 {
2254 if ([gameView isOptDown])
2255 {
2256 [self homeInfoSystem];
2257 target_chart_focus = galaxy_coordinates;
2258 }
2259 else
2260 {
2262 cursor_coordinates = galaxy_coordinates;
2263 target_chart_focus = cursor_coordinates;
2264 target_chart_centre = galaxy_coordinates;
2265 found_system_id = -1;
2266 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
2267 moving = YES;
2268 }
2269 }
2270 if ([self checkKeyPress:n_key_map_end])
2271 {
2272 [self targetInfoSystem];
2273 target_chart_focus = cursor_coordinates;
2274 }
2275 if ([
self checkKeyPress:n_key_map_zoom_in] || [gameView mouseWheelState] ==
gvMouseWheelDown)
2276 {
2279 saved_chart_zoom = target_chart_zoom;
2280 }
2281 if ([
self checkKeyPress:n_key_map_zoom_out] || [gameView mouseWheelState] ==
gvMouseWheelUp)
2282 {
2283 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2284 {
2286 [self setGuiToShortRangeChartScreen];
2287 }
2289 if (target_chart_zoom < 1.0) target_chart_zoom = 1.0;
2290 saved_chart_zoom = target_chart_zoom;
2291
2292 target_chart_focus = target_chart_centre;
2293 }
2294
2296 BOOL nextSystemOnRoute = [gameView
isOptDown];
2297
2298 if ([self checkNavKeyPress:n_key_gui_arrow_left])
2299 {
2300 if ((nextSystem || nextSystemOnRoute) &&
pressedArrow != 1)
2301 {
2302 if (nextSystem)
2303 {
2304 [self targetNewSystem:-1];
2305 target_chart_focus = cursor_coordinates;
2306 }
2307 else
2308 {
2309 [self clearPlanetSearchString];
2310 [self previousInfoSystem];
2311 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2312 }
2314 }
2315 else if (!nextSystem && !nextSystemOnRoute)
2316 {
2318 cursor_coordinates.x -= cursor_speed*delta_t;
2319 if (cursor_coordinates.x < 0.0) cursor_coordinates.x = 0.0;
2320 moving = YES;
2321 target_chart_focus = cursor_coordinates;
2322 }
2323 }
2324 else
2326
2327 if ([self checkNavKeyPress:n_key_gui_arrow_right])
2328 {
2329 if ((nextSystem || nextSystemOnRoute) &&
pressedArrow != 2)
2330 {
2331 if (nextSystem)
2332 {
2333 [self targetNewSystem:+1];
2334 target_chart_focus = cursor_coordinates;
2335 }
2336 else
2337 {
2338 [self clearPlanetSearchString];
2339 [self nextInfoSystem];
2340 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2341 }
2343 }
2344 else if (!nextSystem && !nextSystemOnRoute)
2345 {
2347 cursor_coordinates.x += cursor_speed*delta_t;
2348 if (cursor_coordinates.x > 256.0) cursor_coordinates.x = 256.0;
2349 moving = YES;
2350 target_chart_focus = cursor_coordinates;
2351 }
2352 }
2353 else
2355
2356 if ([self checkNavKeyPress:n_key_gui_arrow_down])
2357 {
2359 {
2360 [self targetNewSystem:+1];
2362 }
2363 else if (!nextSystem)
2364 {
2366 cursor_coordinates.y += cursor_speed*delta_t*2.0;
2367 if (cursor_coordinates.y > 256.0) cursor_coordinates.y = 256.0;
2368 moving = YES;
2369 }
2370 target_chart_focus = cursor_coordinates;
2371 }
2372 else
2374
2375 if ([self checkNavKeyPress:n_key_gui_arrow_up])
2376 {
2378 {
2379 [self targetNewSystem:-1];
2381 }
2382 else if (!nextSystem)
2383 {
2385 cursor_coordinates.y -= cursor_speed*delta_t*2.0;
2386 if (cursor_coordinates.y < 0.0) cursor_coordinates.y = 0.0;
2387 moving = YES;
2388 }
2389 target_chart_focus = cursor_coordinates;
2390 }
2391 else
2394 {
2395 if (found_system_id == -1)
2396 {
2397 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2398 [self setInfoSystemID: target_system_id moveChart: YES];
2399 }
2400 else
2401 {
2402
2403 NSPoint fpos = [[UNIVERSE systemManager] getCoordinatesForSystem:found_system_id inGalaxy:galaxy_number];
2404 if (fpos.x != cursor_coordinates.x && fpos.y != cursor_coordinates.y)
2405 {
2406 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2407 [self setInfoSystemID: target_system_id moveChart: YES];
2408 }
2409 }
2410 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
2411 }
2412 if (chart_focus_coordinates.x - target_chart_centre.x <= -
CHART_SCROLL_AT_X*chart_zoom)
2413 {
2414 target_chart_centre.x = chart_focus_coordinates.x +
CHART_SCROLL_AT_X*chart_zoom;
2415 }
2416 else if (chart_focus_coordinates.x - target_chart_centre.x >=
CHART_SCROLL_AT_X*chart_zoom)
2417 {
2418 target_chart_centre.x = chart_focus_coordinates.x -
CHART_SCROLL_AT_X*chart_zoom;
2419 }
2420 if (chart_focus_coordinates.y - target_chart_centre.y <= -
CHART_SCROLL_AT_Y*chart_zoom)
2421 {
2422 target_chart_centre.y = chart_focus_coordinates.y +
CHART_SCROLL_AT_Y*chart_zoom;
2423 }
2424 else if (chart_focus_coordinates.y - target_chart_centre.y >=
CHART_SCROLL_AT_Y*chart_zoom)
2425 {
2426 target_chart_centre.y = chart_focus_coordinates.y -
CHART_SCROLL_AT_Y*chart_zoom;
2427 }
2428 chart_centre_coordinates.x = (3.0*chart_centre_coordinates.x + target_chart_centre.
x)/4.0;
2429 chart_centre_coordinates.y = (3.0*chart_centre_coordinates.y + target_chart_centre.
y)/4.0;
2430 chart_zoom = (3.0*chart_zoom + target_chart_zoom)/4.0;
2431 chart_focus_coordinates.x = (3.0*chart_focus_coordinates.x + target_chart_focus.
x)/4.0;
2432 chart_focus_coordinates.y = (3.0*chart_focus_coordinates.y + target_chart_focus.
y)/4.0;
2433 if (
cursor_moving || dragging) [
self setGuiToChartScreenFrom: gui_screen];
2435 }
2436 break;
2437
2438 case GUI_SCREEN_SYSTEM_DATA:
2439 if ([self checkKeyPress:n_key_system_next_system])
2440 {
2442 {
2443 [self nextInfoSystem];
2445 }
2446 }
2447 else
2448 {
2450 }
2451 if ([self checkKeyPress:n_key_system_previous_system])
2452 {
2454 {
2455 [self previousInfoSystem];
2457 }
2458 }
2459 else
2460 {
2462 }
2463 if ([self checkKeyPress:n_key_system_home])
2464 {
2466 {
2467 [self homeInfoSystem];
2469 }
2470 }
2471 else
2472 {
2474 }
2475 if ([self checkKeyPress:n_key_system_end])
2476 {
2478 {
2479 [self targetInfoSystem];
2481 }
2482 }
2483 else
2484 {
2486 }
2487 break;
2488
2489#if OO_USE_CUSTOM_LOAD_SAVE
2490
2491 case GUI_SCREEN_LOAD:
2492 {
2493 NSString *commanderFile = [self commanderSelector];
2494 if(commanderFile)
2495 {
2496
2497 [demoShip release];
2499
2500 [self loadPlayerFromFile:commanderFile asNew:NO];
2501 }
2502 break;
2503 }
2504
2505 case GUI_SCREEN_SAVE:
2506 [self pollGuiScreenControlsWithFKeyAlias:NO];
2507
2508
2510 if (gui_screen == GUI_SCREEN_SAVE)
2511 {
2512 [self saveCommanderInputHandler];
2513 }
2514 else pollControls = YES;
2515 break;
2516
2517 case GUI_SCREEN_SAVE_OVERWRITE:
2518 [self overwriteCommanderInputHandler];
2519 break;
2520#endif
2521
2522 case GUI_SCREEN_STICKMAPPER:
2523 [self handleStickMapperScreenKeys];
2524 break;
2525
2526 case GUI_SCREEN_STICKPROFILE:
2527 [self stickProfileInputHandler: gui view: gameView];
2528 break;
2529
2530 case GUI_SCREEN_GAMEOPTIONS:
2531 [self handleGameOptionsScreenKeys];
2532 break;
2533
2534 case GUI_SCREEN_KEYBOARD:
2535 [self handleKeyMapperScreenKeys];
2536
2537
2538
2539
2540 break;
2541
2542 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
2543 [self handleKeyMapperConfirmClearKeys:gui view:gameView];
2544 break;
2545
2546 case GUI_SCREEN_KEYBOARD_CONFIG:
2547 [self handleKeyConfigKeys:gui view:gameView];
2548 break;
2549
2550 case GUI_SCREEN_KEYBOARD_ENTRY:
2551 [self handleKeyConfigEntryKeys:gui view:gameView];
2552 break;
2553
2554 case GUI_SCREEN_KEYBOARD_LAYOUT:
2555 [self handleKeyboardLayoutKeys];
2556 break;
2557
2558 case GUI_SCREEN_SHIPLIBRARY:
2559 if ([gameView isDown:' '])
2560 {
2561
2562 [self setGuiToInterfacesScreen:0];
2563 }
2564 if ([self checkKeyPress:n_key_gui_arrow_up])
2565 {
2567 [UNIVERSE selectIntro2Previous];
2568 }
2569 if ([self checkKeyPress:n_key_gui_arrow_down])
2570 {
2572 [UNIVERSE selectIntro2Next];
2573 }
2574 upDownKeyPressed = (([
self checkKeyPress:n_key_gui_arrow_up])||([
self checkKeyPress:n_key_gui_arrow_down]));
2575
2576 if ([self checkKeyPress:n_key_gui_arrow_left])
2577 {
2579 [UNIVERSE selectIntro2PreviousCategory];
2580 }
2581 if ([self checkKeyPress:n_key_gui_arrow_right])
2582 {
2584 [UNIVERSE selectIntro2NextCategory];
2585 }
2586 leftRightKeyPressed = (([
self checkKeyPress:n_key_gui_arrow_left])||([
self checkKeyPress:n_key_gui_arrow_right]));
2587
2588 break;
2589 case GUI_SCREEN_OPTIONS:
2590 [self handleGUIUpDownArrowKeys];
2592 BOOL selectKeyPress = ([
self checkKeyPress:n_key_gui_select]||[gameView
isDown:gvMouseDoubleClick]);
2593
2594 if (selectKeyPress)
2595 {
2597 {
2598 @try
2599 {
2601 [self quicksavePlayer];
2602 }
2603 @catch (NSException *exception)
2604 {
2605 OOLog(
kOOLogException,
@"\n\n***** Handling exception: %@ : %@ *****\n\n",[exception name], [exception reason]);
2606 if ([[exception name] isEqual:@"GameNotSavedException"])
2607 {
2609 if ([controller inFullScreenMode])
2611 else
2612 [self savePlayer];
2613 }
2614 else
2615 {
2616 @throw exception;
2617 }
2618 }
2619 }
2621 {
2623 [self savePlayer];
2624 }
2626 {
2628 if (![self loadPlayer])
2629 {
2631 [self setGuiToStatusScreen];
2632 }
2633 }
2634
2635
2637 {
2639 [UNIVERSE setUseAddOns:SCENARIO_OXP_DEFINITION_ALL fromSaveGame:NO forceReinit:YES];
2640 }
2641
2643 [gameView clearMouse];
2644 }
2645 else
2646 {
2648 }
2649
2650#if OOLITE_SDL
2651
2652
2653
2654 if ((guiSelectedRow ==
GUI_ROW(,QUIT)) && selectKeyPress)
2655 {
2656 [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on options screen"];
2657 }
2658#endif
2659
2660 if ((guiSelectedRow ==
GUI_ROW(,GAMEOPTIONS)) && selectKeyPress)
2661 {
2663 [self setGuiToGameOptionsScreen];
2664 }
2665
2666 break;
2667
2668 case GUI_SCREEN_EQUIP_SHIP:
2669 if ([self handleGUIUpDownArrowKeys])
2670 {
2673
2678
2679 if (weaponType !=
nil)
2680 {
2682
2683 if ([[weaponType identifier] isEqualToString:
@"EQ_WEAPON_NONE"]) itemText =
DESC(
@"no-weapon-enter-to-install");
2684 else
2685 {
2687 if (sameAs) itemText = [NSString stringWithFormat:DESC(@"weapon-installed-@"), weaponName];
2688 else itemText = [NSString stringWithFormat:DESC(@"weapon-@-enter-to-replace"), weaponName];
2689 }
2690
2691 [self showInformationForSelectedUpgradeWithFormatString:itemText];
2692 }
2693 else
2694 [self showInformationForSelectedUpgrade];
2695 }
2696
2697 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
2698 {
2700 {
2702 {
2703 [self playMenuPagePrevious];
2705 [self buySelectedItem];
2706 }
2708 }
2709 }
2710 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
2711 {
2713 {
2715 {
2716 [self playMenuPageNext];
2717 [gui
setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
2718 [self buySelectedItem];
2719 }
2721 }
2722 }
2723 leftRightKeyPressed = [
self checkKeyPress:n_key_gui_arrow_right]|[
self checkKeyPress:n_key_gui_arrow_left]|[
self checkKeyPress:n_key_gui_page_down]|[
self checkKeyPress:n_key_gui_page_up];
2724
2726 {
2728 {
2731 }
2733 {
2734 [self buySelectedItem];
2736 }
2737 }
2738 else
2739 {
2741 }
2742 break;
2743
2744 case GUI_SCREEN_INTERFACES:
2745 if ([self handleGUIUpDownArrowKeys])
2746 {
2747 [self showInformationForSelectedInterface];
2748 }
2749 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
2750 {
2752 {
2754 {
2755 [self playMenuPagePrevious];
2757 [self activateSelectedInterface];
2758 }
2760 }
2761 }
2762 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
2763 {
2765 {
2767 {
2768 [self playMenuPageNext];
2769 [gui
setSelectedRow:GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES - 1];
2770 [self activateSelectedInterface];
2771 }
2773 }
2774 }
2775 leftRightKeyPressed = [
self checkKeyPress:n_key_gui_arrow_right]|[
self checkKeyPress:n_key_gui_arrow_left]|[
self checkKeyPress:n_key_gui_page_down]|[
self checkKeyPress:n_key_gui_page_up];
2777 {
2779 {
2782 }
2784 {
2785 [self activateSelectedInterface];
2787 }
2788 }
2789 else
2790 {
2792 }
2793 break;
2794
2795
2796 case GUI_SCREEN_MARKETINFO:
2797 [self pollMarketScreenControls];
2798 break;
2799
2800 case GUI_SCREEN_MARKET:
2801 [self pollMarketScreenControls];
2802
2803 if ([
self checkKeyPress:n_key_market_filter_cycle] || [
self checkKeyPress:n_key_market_sorter_cycle])
2804 {
2806 {
2808 if ([self checkKeyPress:n_key_market_filter_cycle])
2809 {
2811 {
2813 }
2814 else
2815 {
2816 marketFilterMode++;
2817 }
2818 }
2819 else
2820 {
2822 {
2824 }
2825 else
2826 {
2827 marketSorterMode++;
2828 }
2829 }
2830 [self playChangedOption];
2831 [self setGuiToMarketScreen];
2832 }
2833 }
2834 else
2835 {
2837 }
2838
2839 break;
2840
2841 case GUI_SCREEN_REPORT:
2842 if ([gameView isDown:32])
2843 {
2845 {
2846 BOOL reportEnded = ([dockingReport length] == 0);
2847 [self playDismissedReportScreen];
2848 if(reportEnded)
2849 {
2850 [self setGuiToStatusScreen];
2851 [self doScriptEvent:OOJSID("reportScreenEnded")];
2852 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")];
2853 }
2854 else
2855 {
2856 [self setGuiToDockingReportScreen];
2857 }
2858
2859 }
2861 }
2862 else
2864 break;
2865 case GUI_SCREEN_STATUS:
2866 [self handleGUIUpDownArrowKeys];
2867 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
2868 {
2869
2871 {
2873 {
2875 [self playMenuPagePrevious];
2877 [self setGuiToStatusScreen];
2878 }
2880 }
2881 }
2882 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
2883 {
2884
2886 {
2889 {
2891 [self playMenuPageNext];
2893 [self setGuiToStatusScreen];
2894 }
2896 }
2897 }
2898 leftRightKeyPressed = [
self checkKeyPress:n_key_gui_arrow_right]|[
self checkKeyPress:n_key_gui_arrow_left]|[
self checkKeyPress:n_key_gui_page_down]|[
self checkKeyPress:n_key_gui_page_up];
2899
2901 {
2903 {
2906 }
2908 {
2910 [self setGuiToStatusScreen];
2911
2913 }
2914 }
2915 else
2916 {
2918 }
2919
2920 break;
2921 case GUI_SCREEN_MANIFEST:
2922 [self handleGUIUpDownArrowKeys];
2923 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
2924 {
2925
2927 {
2929 {
2931 [self playMenuPagePrevious];
2933 [self setGuiToManifestScreen];
2934 }
2936 }
2937 }
2938 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
2939 {
2941 if ([[self hud] isHidden] || [[self hud] allowBigGui])
2942 {
2943 nextRow += 7;
2944 }
2946 {
2947 if ([[gui keyForRow:nextRow] isEqual:
GUI_KEY_OK])
2948 {
2950 [self playMenuPageNext];
2952 [self setGuiToManifestScreen];
2953 }
2955 }
2956 }
2957 leftRightKeyPressed = [
self checkKeyPress:n_key_gui_arrow_right]|[
self checkKeyPress:n_key_gui_arrow_left]|[
self checkKeyPress:n_key_gui_page_down]|[
self checkKeyPress:n_key_gui_page_up];
2958
2960 {
2962 {
2965 }
2967 {
2969 [self setGuiToManifestScreen];
2970
2972 }
2973 }
2974 else
2975 {
2977 }
2978
2979 break;
2980
2981 case GUI_SCREEN_SHIPYARD:
2982 if ([self handleGUIUpDownArrowKeys])
2983 {
2984 [self showShipyardInfoForSelection];
2985 }
2986
2987 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
2988 {
2990 {
2992 {
2993 [self playMenuPagePrevious];
2995 [self buySelectedShip];
2996 }
2998 }
2999 }
3000 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
3001 {
3003 {
3005 {
3006 [self playMenuPageNext];
3007 [gui
setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
3008 [self buySelectedShip];
3009 }
3011 }
3012 }
3013 leftRightKeyPressed = [
self checkKeyPress:n_key_gui_arrow_right]|[
self checkKeyPress:n_key_gui_arrow_left]|[
self checkKeyPress:n_key_gui_page_down]|[
self checkKeyPress:n_key_gui_page_up];
3014
3015 if ([self checkKeyPress:n_key_gui_select])
3016 {
3018 {
3019
3022 if (![key hasPrefix:@"More:"])
3023 {
3024 shipprice = [self priceForShipKey:key];
3025 }
3026
3027 if ([self buySelectedShip])
3028 {
3029 if (![key hasPrefix:@"More:"])
3030 {
3031 [UNIVERSE removeDemoShips];
3032 [self setGuiToStatusScreen];
3033 [self playBuyShip];
3034 [self doScriptEvent:OOJSID("playerBoughtNewShip") withArgument:self andArgument:[NSNumber numberWithUnsignedLongLong:shipprice]];
3035 }
3036 }
3037 else
3038 {
3039 [self playCantBuyShip];
3040 }
3041 }
3043 }
3044 else
3045 {
3047 }
3049 {
3051 {
3052 [self playMenuPageNext];
3053 [gui
setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
3054 [self buySelectedShip];
3055 }
3057 {
3058 [self playMenuPagePrevious];
3060 [self buySelectedShip];
3061 }
3063 }
3064
3065 break;
3066
3067 default:
3068 break;
3069 }
3070
3071
3072 NSArray *keys = [extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d", gui_screen]];
3073 if (keys) {
3074 NSInteger kc = [keys count];
3076 NSDictionary *keydefs =
nil;
3077 NSString *key =
nil;
3078 while (kc--) {
3079 definition = [keys objectAtIndex:kc];
3081 foreach (key, [keydefs allKeys])
3082 {
3083 if ([self checkKeyPress:[keydefs objectForKey:key]])
3084 {
3086 {
3087
3088 if (definition)
3089 {
3090 [[UNIVERSE gameView] clearKeys];
3092 }
3093 else
3094 {
3095 OOLog(
@"interface.missingCallback",
@"Unable to find callback definition for %@ using key %@", [definition name], key);
3096 }
3097 }
3099 }
3100 else
3102 }
3103 }
3104 }
3105
3106
3107 if (flightRoll > 0.0)
3108 {
3109 if (flightRoll > delta_t) [self decrease_flight_roll:delta_t];
3110 else flightRoll = 0.0;
3111 }
3112 if (flightRoll < 0.0)
3113 {
3114 if (flightRoll < -delta_t) [self increase_flight_roll:delta_t];
3115 else flightRoll = 0.0;
3116 }
3117 if (flightPitch > 0.0)
3118 {
3119 if (flightPitch > delta_t) [self decrease_flight_pitch:delta_t];
3120 else flightPitch = 0.0;
3121 }
3122 if (flightPitch < 0.0)
3123 {
3124 if (flightPitch < -delta_t) [self increase_flight_pitch:delta_t];
3125 else flightPitch = 0.0;
3126 }
3127 if (flightYaw > 0.0)
3128 {
3129 if (flightYaw > delta_t) [self decrease_flight_yaw:delta_t];
3130 else flightYaw = 0.0;
3131 }
3132 if (flightYaw < 0.0)
3133 {
3134 if (flightYaw < -delta_t) [self increase_flight_yaw:delta_t];
3135 else flightYaw = 0.0;
3136 }
3137}
#define MAIN_GUI_PIXEL_WIDTH
#define MAIN_GUI_PIXEL_HEIGHT
uint64_t OOCreditsQuantity
#define MAX_ROWS_SHIPS_FOR_SALE
#define GUI_ROW_SHIPYARD_START
static BOOL extra_gui_key_pressed
static NSPoint centre_at_mouse_click
static BOOL chartInfoPressed
static BOOL next_planet_info_pressed
static BOOL target_info_pressed
static BOOL home_info_pressed
static BOOL previous_planet_info_pressed
static BOOL mouse_left_down
static BOOL pling_pressed
static NSUInteger searchStringLength
static NSPoint mouse_click_position
static BOOL cursor_moving
#define CHART_SCREEN_VERTICAL_CENTRE
@ STATUS_EQUIPMENT_FIRST_ROW
@ STATUS_EQUIPMENT_MAX_ROWS
@ GUI_ROW_EQUIPMENT_START
@ STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS
@ GUI_ROW_INTERFACES_START
@ GUI_MAX_ROWS_INTERFACES
#define PORT_FACING_STRING
#define CHART_ZOOM_SHOW_LABELS
#define MANIFEST_SCREEN_ROW_BACK
#define FORWARD_FACING_STRING
#define AFT_FACING_STRING
#define CHART_ZOOM_SPEED_FACTOR
#define MANIFEST_SCREEN_ROW_NEXT
#define STARBOARD_FACING_STRING
#define CHART_SCROLL_AT_Y
#define CHART_SCROLL_AT_X
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string) PURE_FUNC
void handleUndockControl()
void setStatusPage:(NSInteger pageNum)
NSString * selectedRowText()
void runCallback:(NSString *key)
NSDictionary * registerKeys()