Line data Source code
1 0 : /*
2 :
3 : PlayerEntity.h
4 :
5 : Entity subclass nominally representing the player's ship, but also
6 : implementing much of the interaction, menu system etc. Breaking it up into
7 : ten or so different classes is a perennial to-do item.
8 :
9 : Oolite
10 : Copyright (C) 2004-2013 Giles C Williams and contributors
11 :
12 : This program is free software; you can redistribute it and/or
13 : modify it under the terms of the GNU General Public License
14 : as published by the Free Software Foundation; either version 2
15 : of the License, or (at your option) any later version.
16 :
17 : This program is distributed in the hope that it will be useful,
18 : but WITHOUT ANY WARRANTY; without even the implied warranty of
19 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 : GNU General Public License for more details.
21 :
22 : You should have received a copy of the GNU General Public License
23 : along with this program; if not, write to the Free Software
24 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 : MA 02110-1301, USA.
26 :
27 : */
28 :
29 : #import <Foundation/Foundation.h>
30 : #import "WormholeEntity.h"
31 : #import "ShipEntity.h"
32 : #import "GuiDisplayGen.h"
33 : #import "OOTypes.h"
34 : #import "OOJSPropID.h"
35 : #import "OOCommodityMarket.h"
36 :
37 : @class GuiDisplayGen, OOTrumble, MyOpenGLView, HeadUpDisplay, ShipEntity;
38 : @class OOSound, OOSoundSource, OOSoundReferencePoint;
39 : @class OOJoystickManager, OOTexture, OOLaserShotEntity;
40 : @class StickProfileScreen, OOJSGuiScreenKeyDefinition;
41 :
42 0 : #define ALLOW_CUSTOM_VIEWS_WHILE_PAUSED 1
43 0 : #define SCRIPT_TIMER_INTERVAL 10.0
44 :
45 : #ifndef OO_VARIABLE_TORUS_SPEED
46 0 : #define OO_VARIABLE_TORUS_SPEED 1
47 : #endif
48 :
49 0 : #define GUI_ROW_INIT(GUI) /*int n_rows = [(GUI) rows]*/
50 0 : #define GUI_FIRST_ROW(GROUP) ((GUI_DEFAULT_ROWS - GUI_ROW_##GROUP##OPTIONS_END_OF_LIST) / 2)
51 : // reposition menu
52 0 : #define GUI_ROW(GROUP,ITEM) (GUI_FIRST_ROW(GROUP) - 4 + GUI_ROW_##GROUP##OPTIONS_##ITEM)
53 :
54 0 : #define CUSTOM_VIEW_MAX_ZOOM_IN 1.5
55 0 : #define CUSTOM_VIEW_MAX_ZOOM_OUT 25
56 :
57 0 : #define ENTRY(label, value) label,
58 :
59 0 : typedef enum
60 : {
61 : #include "OOGUIScreenID.tbl"
62 : } OOGUIScreenID;
63 :
64 0 : #define GALACTIC_HYPERSPACE_ENTRY(label, value) GALACTIC_HYPERSPACE_##label = value,
65 :
66 0 : typedef enum
67 : {
68 : #include "OOGalacticHyperspaceBehaviour.tbl"
69 :
70 : GALACTIC_HYPERSPACE_MAX = GALACTIC_HYPERSPACE_BEHAVIOUR_FIXED_COORDINATES
71 : } OOGalacticHyperspaceBehaviour;
72 :
73 : #undef ENTRY
74 : #undef GALACTIC_HYPERSPACE_ENTRY
75 :
76 :
77 0 : enum
78 : {
79 : // Values used for unknown strings.
80 : kOOGUIScreenIDDefault = GUI_SCREEN_MAIN,
81 : kOOGalacticHyperspaceBehaviourDefault = GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN
82 : };
83 :
84 0 : typedef enum
85 : {
86 : OOPRIMEDEQUIP_ACTIVATED,
87 : OOPRIMEDEQUIP_MODE
88 : } OOPrimedEquipmentMode;
89 :
90 0 : typedef enum
91 : {
92 : OOSPEECHSETTINGS_OFF = 0,
93 : OOSPEECHSETTINGS_COMMS = 1,
94 : OOSPEECHSETTINGS_ALL = 2
95 : } OOSpeechSettings;
96 :
97 :
98 : // When fully zoomed in, chart shows area of galaxy that's 64x64 galaxy units.
99 0 : #define CHART_WIDTH_AT_MAX_ZOOM 64.0
100 0 : #define CHART_HEIGHT_AT_MAX_ZOOM 64.0
101 : // Galaxy width / width of chart area at max zoom
102 0 : #define CHART_MAX_ZOOM (256.0/CHART_WIDTH_AT_MAX_ZOOM)
103 : //start scrolling when cursor is this number of units away from centre
104 0 : #define CHART_SCROLL_AT_X 25.0
105 0 : #define CHART_SCROLL_AT_Y 31.0
106 0 : #define CHART_CLIP_BORDER 10.0
107 0 : #define CHART_SCREEN_VERTICAL_CENTRE (10*MAIN_GUI_ROW_HEIGHT)
108 0 : #define CHART_SCREEN_VERTICAL_CENTRE_COMPACT (7*MAIN_GUI_ROW_HEIGHT)
109 0 : #define CHART_ZOOM_SPEED_FACTOR 1.05
110 :
111 0 : #define CHART_ZOOM_SHOW_LABELS 2.0
112 :
113 : // OO_RESOLUTION_OPTION: true if full screen resolution can be changed.
114 : #if OOLITE_MAC_OS_X && OOLITE_64_BIT
115 : #define OO_RESOLUTION_OPTION 0
116 : #else
117 0 : #define OO_RESOLUTION_OPTION 1
118 : #endif
119 :
120 : // dictionary keys - used in the custom key config for oxp equipment
121 0 : #define CUSTOMEQUIP_EQUIPKEY @"equipmentKey"
122 0 : #define CUSTOMEQUIP_EQUIPNAME @"equipmentName"
123 0 : #define CUSTOMEQUIP_KEYACTIVATE @"keyActivate"
124 0 : #define CUSTOMEQUIP_KEYMODE @"keyMode"
125 0 : #define CUSTOMEQUIP_BUTTONACTIVATE @"buttonActivate"
126 0 : #define CUSTOMEQUIP_BUTTONMODE @"buttonMode"
127 0 : #define KEYCONFIG_CUSTOMEQUIP @"CustomEquipActivation" // NSUserDefaults
128 :
129 0 : enum
130 : {
131 : GUI_ROW_OPTIONS_QUICKSAVE,
132 : GUI_ROW_OPTIONS_SAVE,
133 : GUI_ROW_OPTIONS_LOAD,
134 : GUI_ROW_OPTIONS_SPACER1,
135 : GUI_ROW_OPTIONS_GAMEOPTIONS,
136 : GUI_ROW_OPTIONS_SPACER2,
137 : GUI_ROW_OPTIONS_BEGIN_NEW,
138 : #if OOLITE_SDL
139 : GUI_ROW_OPTIONS_SPACER3,
140 : GUI_ROW_OPTIONS_QUIT,
141 : #endif
142 : GUI_ROW_OPTIONS_END_OF_LIST,
143 :
144 : STATUS_EQUIPMENT_FIRST_ROW = 10,
145 : STATUS_EQUIPMENT_MAX_ROWS = 8,
146 : STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS = 6,
147 :
148 : GUI_ROW_EQUIPMENT_START = 3,
149 : GUI_MAX_ROWS_EQUIPMENT = 12,
150 : GUI_ROW_EQUIPMENT_DETAIL = GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT + 1,
151 : GUI_ROW_EQUIPMENT_CASH = 1,
152 : GUI_ROW_MARKET_KEY = 1,
153 : GUI_ROW_MARKET_START = 2,
154 : GUI_ROW_MARKET_SCROLLUP = 4,
155 : GUI_ROW_MARKET_SCROLLDOWN = 16,
156 : GUI_ROW_MARKET_LAST = 18,
157 : GUI_ROW_MARKET_END = 19,
158 : GUI_ROW_MARKET_CASH = 20,
159 : GUI_ROW_INTERFACES_HEADING = 1,
160 : GUI_ROW_INTERFACES_START = 3,
161 : GUI_MAX_ROWS_INTERFACES = 12,
162 : GUI_ROW_INTERFACES_DETAIL = GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES + 1,
163 : GUI_ROW_NO_INTERFACES = 3,
164 : GUI_ROW_SCENARIOS_START = 3,
165 : GUI_MAX_ROWS_SCENARIOS = 12,
166 : GUI_ROW_SCENARIOS_DETAIL = GUI_ROW_SCENARIOS_START + GUI_MAX_ROWS_SCENARIOS + 2,
167 : GUI_ROW_CHART_SYSTEM = 19,
168 : GUI_ROW_CHART_SYSTEM_COMPACT = 17,
169 : GUI_ROW_PLANET_FINDER = 20
170 : };
171 :
172 : #if GUI_FIRST_ROW() < 0
173 : # error Too many items in OPTIONS list!
174 : #endif
175 :
176 0 : enum
177 : {
178 : GUI_ROW_GAMEOPTIONS_AUTOSAVE,
179 : GUI_ROW_GAMEOPTIONS_DOCKINGCLEARANCE,
180 : GUI_ROW_GAMEOPTIONS_SPACER1,
181 : GUI_ROW_GAMEOPTIONS_VOLUME,
182 : #if OOLITE_SPEECH_SYNTH
183 : GUI_ROW_GAMEOPTIONS_SPEECH,
184 : #if !OOLITE_MAC_OS_X
185 : // FIXME: should have voice option for OS X
186 : GUI_ROW_GAMEOPTIONS_SPEECH_LANGUAGE,
187 : GUI_ROW_GAMEOPTIONS_SPEECH_GENDER,
188 : #endif
189 : #endif
190 : GUI_ROW_GAMEOPTIONS_MUSIC,
191 : #if OO_RESOLUTION_OPTION
192 : GUI_ROW_GAMEOPTIONS_SPACER2,
193 : GUI_ROW_GAMEOPTIONS_DISPLAY,
194 : #endif
195 : GUI_ROW_GAMEOPTIONS_DISPLAYSTYLE,
196 : GUI_ROW_GAMEOPTIONS_DETAIL,
197 : GUI_ROW_GAMEOPTIONS_WIREFRAMEGRAPHICS,
198 : #if !NEW_PLANETS
199 : GUI_ROW_GAMEOPTIONS_PROCEDURALLYTEXTUREDPLANETS,
200 : #endif
201 : GUI_ROW_GAMEOPTIONS_SHADEREFFECTS,
202 : #if OOLITE_SDL
203 : GUI_ROW_GAMEOPTIONS_GAMMA,
204 : #endif
205 : GUI_ROW_GAMEOPTIONS_FOV,
206 : GUI_ROW_GAMEOPTIONS_COLORBLINDMODE,
207 : GUI_ROW_GAMEOPTIONS_SPACER_STICKMAPPER,
208 : GUI_ROW_GAMEOPTIONS_STICKMAPPER,
209 : GUI_ROW_GAMEOPTIONS_KEYMAPPER,
210 : GUI_ROW_GAMEOPTIONS_SPACER3,
211 : GUI_ROW_GAMEOPTIONS_BACK,
212 :
213 : GUI_ROW_GAMEOPTIONS_END_OF_LIST
214 : };
215 : #if GUI_FIRST_ROW() < 0
216 : # error Too many items in GAMEOPTIONS list!
217 : #endif
218 :
219 0 : enum
220 : {
221 : GUI_ROW_GAMEOPTIONS_HDRPAPERWHITE = GUI_ROW_GAMEOPTIONS_WIREFRAMEGRAPHICS,
222 : GUI_ROW_GAMEOPTIONS_HDRMAXBRIGHTNESS = GUI_ROW_GAMEOPTIONS_DETAIL
223 : };
224 :
225 :
226 0 : typedef enum
227 : {
228 : // Exposed to shaders.
229 : SCOOP_STATUS_NOT_INSTALLED = 0,
230 : SCOOP_STATUS_FULL_HOLD,
231 : SCOOP_STATUS_OKAY,
232 : SCOOP_STATUS_ACTIVE
233 : } OOFuelScoopStatus;
234 :
235 :
236 0 : enum
237 : {
238 : ALERT_FLAG_DOCKED = 0x010,
239 : ALERT_FLAG_MASS_LOCK = 0x020,
240 : ALERT_FLAG_YELLOW_LIMIT = 0x03f,
241 : ALERT_FLAG_TEMP = 0x040,
242 : ALERT_FLAG_ALT = 0x080,
243 : ALERT_FLAG_ENERGY = 0x100,
244 : ALERT_FLAG_HOSTILES = 0x200
245 : };
246 0 : typedef uint16_t OOAlertFlags;
247 :
248 :
249 0 : typedef enum
250 : {
251 : // Exposed to shaders.
252 : MISSILE_STATUS_SAFE,
253 : MISSILE_STATUS_ARMED,
254 : MISSILE_STATUS_TARGET_LOCKED
255 : } OOMissileStatus;
256 :
257 :
258 0 : typedef enum
259 : {
260 : PLAYER_FLEEING_UNLIKELY = -1,
261 : PLAYER_FLEEING_NONE = 0,
262 : PLAYER_FLEEING_MAYBE = 1,
263 : PLAYER_FLEEING_CARGO = 2,
264 : PLAYER_FLEEING_LIKELY = 3
265 : } OOPlayerFleeingStatus;
266 :
267 :
268 0 : typedef enum
269 : {
270 : MARKET_FILTER_MODE_OFF = 0,
271 : MARKET_FILTER_MODE_TRADE = 1,
272 : MARKET_FILTER_MODE_HOLD = 2,
273 : MARKET_FILTER_MODE_STOCK = 3,
274 : MARKET_FILTER_MODE_LEGAL = 4,
275 : MARKET_FILTER_MODE_RESTRICTED = 5, // import or export
276 :
277 :
278 : MARKET_FILTER_MODE_MAX = 5 // always equal to highest real mode
279 : } OOMarketFilterMode;
280 :
281 :
282 0 : typedef enum
283 : {
284 : MARKET_SORTER_MODE_OFF = 0,
285 : MARKET_SORTER_MODE_ALPHA = 1,
286 : MARKET_SORTER_MODE_PRICE = 2,
287 : MARKET_SORTER_MODE_STOCK = 3,
288 : MARKET_SORTER_MODE_HOLD = 4,
289 : MARKET_SORTER_MODE_UNIT = 5,
290 :
291 : MARKET_SORTER_MODE_MAX = 5 // always equal to highest real mode
292 : } OOMarketSorterMode;
293 :
294 :
295 0 : #define ECM_ENERGY_DRAIN_FACTOR 20.0f
296 0 : #define ECM_DURATION 2.5f
297 :
298 0 : #define ROLL_DAMPING_FACTOR 1.0f
299 0 : #define PITCH_DAMPING_FACTOR 1.0f
300 0 : #define YAW_DAMPING_FACTOR 1.0f
301 :
302 0 : #define PLAYER_MAX_WEAPON_TEMP 256.0f
303 : #ifdef OO_DUMP_PLANETINFO
304 : // debugging
305 : #define PLAYER_MAX_FUEL 7000
306 : #else
307 0 : #define PLAYER_MAX_FUEL 70
308 : #endif
309 0 : #define PLAYER_MAX_MISSILES 16
310 0 : #define PLAYER_STARTING_MAX_MISSILES 4
311 0 : #define PLAYER_STARTING_MISSILES 3
312 0 : #define PLAYER_DIAL_MAX_ALTITUDE 40000.0
313 0 : #define PLAYER_SUPER_ALTITUDE2 10000000000.0
314 :
315 0 : #define PLAYER_MAX_TRUMBLES 24
316 :
317 0 : #define PLAYER_TARGET_MEMORY_SIZE 16
318 :
319 : #if OO_VARIABLE_TORUS_SPEED
320 0 : #define HYPERSPEED_FACTOR [PLAYER hyperspeedFactor]
321 0 : #define MIN_HYPERSPEED_FACTOR 32.0
322 0 : #define MAX_HYPERSPEED_FACTOR 1024.0
323 : #else
324 : #define HYPERSPEED_FACTOR 32.0
325 : #endif
326 :
327 0 : #define PLAYER_SHIP_DESC @"cobra3-player"
328 :
329 0 : #define ESCAPE_SEQUENCE_TIME 10.0
330 :
331 0 : #define FORWARD_FACING_STRING DESC(@"forward-facing-string")
332 0 : #define AFT_FACING_STRING DESC(@"aft-facing-string")
333 0 : #define PORT_FACING_STRING DESC(@"port-facing-string")
334 0 : #define STARBOARD_FACING_STRING DESC(@"starboard-facing-string")
335 :
336 0 : #define KEY_REPEAT_INTERVAL 0.20
337 :
338 0 : #define PLAYER_SHIP_CLOCK_START (2084004 * 86400.0)
339 : // adding or removing a player ship subentity increases or decreases the ship's trade-in factor respectively by this amount
340 0 : #define PLAYER_SHIP_SUBENTITY_TRADE_IN_VALUE 3
341 :
342 0 : #define CONTRACTS_GOOD_KEY @"contracts_fulfilled"
343 0 : #define CONTRACTS_BAD_KEY @"contracts_expired"
344 0 : #define CONTRACTS_UNKNOWN_KEY @"contracts_unknown"
345 0 : #define PASSAGE_GOOD_KEY @"passage_fulfilled"
346 0 : #define PASSAGE_BAD_KEY @"passage_expired"
347 0 : #define PASSAGE_UNKNOWN_KEY @"passage_unknown"
348 0 : #define PARCEL_GOOD_KEY @"parcels_fulfilled"
349 0 : #define PARCEL_BAD_KEY @"parcels_expired"
350 0 : #define PARCEL_UNKNOWN_KEY @"parcels_unknown"
351 :
352 :
353 0 : #define SCANNER_ZOOM_RATE_UP 2.0
354 0 : #define SCANNER_ZOOM_RATE_DOWN -8.0
355 0 : #define SCANNER_ECM_FUZZINESS 1.25
356 :
357 0 : #define PLAYER_INTERNAL_DAMAGE_FACTOR 31
358 :
359 0 : #define PLAYER_DOCKING_AI_NAME @"oolite-player-AI.plist"
360 :
361 0 : #define MANIFEST_SCREEN_ROW_BACK 1
362 0 : #define MANIFEST_SCREEN_ROW_NEXT ([[PLAYER hud] isHidden]?27:20)
363 :
364 0 : #define MISSION_DEST_LEGACY @"__oolite_legacy_destinations"
365 :
366 :
367 0 : @interface PlayerEntity: ShipEntity
368 : {
369 : @private
370 0 : OOSystemID system_id;
371 0 : OOSystemID target_system_id;
372 0 : OOSystemID info_system_id;
373 0 : OOSystemID previous_system_id;
374 :
375 0 : float occlusion_dial;
376 :
377 0 : OOSystemID found_system_id;
378 0 : int ship_trade_in_factor;
379 :
380 0 : NSDictionary *worldScripts;
381 0 : NSDictionary *worldScriptsRequiringTickle;
382 0 : NSMutableDictionary *commodityScripts;
383 0 : NSMutableDictionary *mission_variables;
384 0 : NSMutableDictionary *localVariables;
385 0 : NSString *_missionTitle;
386 0 : NSInteger /*OOGUIRow*/ missionTextRow;
387 0 : NSString *missionChoice;
388 0 : NSString *missionKeyPress;
389 0 : BOOL _missionWithCallback;
390 0 : BOOL _missionAllowInterrupt;
391 0 : BOOL _missionTextEntry;
392 0 : OOGUIScreenID _missionExitScreen;
393 :
394 0 : NSString *specialCargo;
395 :
396 0 : NSMutableArray *commLog;
397 :
398 0 : NSMutableArray *eqScripts;
399 :
400 0 : NSDictionary *_missionOverlayDescriptor;
401 0 : NSDictionary *_missionBackgroundDescriptor;
402 0 : OOGUIBackgroundSpecial _missionBackgroundSpecial;
403 0 : NSDictionary *_equipScreenBackgroundDescriptor;
404 0 : NSString *_missionScreenID;
405 :
406 0 : BOOL found_equipment;
407 :
408 0 : NSMutableDictionary *reputation;
409 :
410 0 : unsigned max_passengers;
411 0 : NSMutableArray *passengers;
412 0 : NSMutableDictionary *passenger_record;
413 :
414 0 : NSMutableArray *parcels;
415 0 : NSMutableDictionary *parcel_record;
416 :
417 0 : NSMutableArray *contracts;
418 0 : NSMutableDictionary *contract_record;
419 :
420 0 : NSMutableDictionary *shipyard_record;
421 :
422 0 : NSMutableDictionary *missionDestinations;
423 0 : NSMutableArray *roleWeights;
424 : // temporary flags for role actions taking multiple steps, cleared on jump
425 0 : NSMutableDictionary *roleWeightFlags;
426 0 : NSMutableArray *roleSystemList; // list of recently visited sysids
427 :
428 0 : double script_time;
429 0 : double script_time_check;
430 0 : double script_time_interval;
431 0 : NSString *lastTextKey;
432 :
433 0 : double ship_clock;
434 0 : double ship_clock_adjust;
435 :
436 0 : double escape_pod_rescue_time;
437 :
438 0 : double fps_check_time;
439 0 : int fps_counter;
440 0 : double last_fps_check_time;
441 :
442 0 : NSString *planetSearchString;
443 :
444 0 : OOMatrix playerRotMatrix;
445 :
446 0 : BOOL showingLongRangeChart;
447 :
448 : // For OO-GUI based save screen
449 0 : NSString *commanderNameString;
450 0 : NSMutableArray *cdrDetailArray;
451 0 : int currentPage;
452 0 : BOOL pollControls;
453 : // ...end save screen
454 :
455 0 : NSInteger marketOffset;
456 0 : OOCommodityType marketSelectedCommodity;
457 0 : OOMarketFilterMode marketFilterMode;
458 0 : OOMarketSorterMode marketSorterMode;
459 :
460 0 : OOWeakReference *_dockedStation;
461 :
462 : /* Used by the DOCKING_CLEARANCE code to implement docking at non-main
463 : * stations. Could possibly overload use of 'dockedStation' instead
464 : * but that needs futher investigation to ensure it doesn't break anything. */
465 0 : StationEntity *targetDockStation;
466 :
467 0 : HeadUpDisplay *hud;
468 0 : NSMutableDictionary *multiFunctionDisplayText;
469 0 : NSMutableArray *multiFunctionDisplaySettings;
470 0 : NSUInteger activeMFD;
471 0 : NSMutableDictionary *customDialSettings;
472 :
473 0 : GLfloat roll_delta, pitch_delta, yaw_delta;
474 0 : GLfloat launchRoll;
475 :
476 0 : GLfloat forward_shield, aft_shield;
477 0 : GLfloat max_forward_shield, max_aft_shield, forward_shield_recharge_rate, aft_shield_recharge_rate;
478 0 : OOTimeDelta forward_shot_time, aft_shot_time, port_shot_time, starboard_shot_time;
479 :
480 0 : OOWeaponFacing chosen_weapon_facing; // for purchasing weapons
481 :
482 0 : double ecm_start_time;
483 0 : double last_ecm_time;
484 :
485 0 : OOGUIScreenID gui_screen;
486 0 : OOAlertFlags alertFlags;
487 0 : OOAlertCondition alertCondition;
488 0 : OOAlertCondition lastScriptAlertCondition;
489 0 : OOPlayerFleeingStatus fleeing_status;
490 0 : OOMissileStatus missile_status;
491 0 : NSUInteger activeMissile;
492 0 : NSUInteger primedEquipment;
493 0 : NSString *_fastEquipmentA;
494 0 : NSString *_fastEquipmentB;
495 :
496 0 : OOCargoQuantity current_cargo;
497 :
498 0 : NSPoint cursor_coordinates;
499 0 : NSPoint chart_focus_coordinates;
500 0 : NSPoint chart_centre_coordinates;
501 0 : NSPoint custom_chart_centre_coordinates;
502 : // where we want the chart centre to be - used for smooth transitions
503 0 : NSPoint target_chart_centre;
504 0 : NSPoint target_chart_focus;
505 : // Chart zoom is 1.0 when fully zoomed in and increases as we zoom out. The reason I've done it that way round
506 : // is because we might want to implement bigger galaxies one day, and thus may need to zoom out indefinitely.
507 0 : OOScalar chart_zoom;
508 0 : OOScalar custom_chart_zoom;
509 0 : OOScalar target_chart_zoom;
510 0 : OOScalar saved_chart_zoom;
511 0 : OORouteType ANA_mode;
512 0 : OOTimeDelta witchspaceCountdown;
513 :
514 0 : NSString *_jumpCause;
515 :
516 : // player commander data
517 0 : NSString *_commanderName;
518 0 : NSString *_lastsaveName;
519 0 : NSPoint galaxy_coordinates;
520 :
521 0 : OOCreditsQuantity credits;
522 0 : OOGalaxyID galaxy_number;
523 :
524 0 : OOCommodityMarket *shipCommodityData;
525 :
526 0 : ShipEntity *missile_entity[PLAYER_MAX_MISSILES]; // holds the actual missile entities or equivalents
527 0 : OOUniversalID _dockTarget; // used by the escape pod code
528 :
529 0 : int legalStatus; // legalStatus both is and isn't an OOCreditsQuantity, because of quantum.
530 0 : int market_rnd;
531 0 : unsigned ship_kills;
532 :
533 0 : OOCompassMode compassMode;
534 0 : OOWeakReference *compassTarget;
535 :
536 0 : GLfloat fuel_leak_rate;
537 :
538 : #if OO_VARIABLE_TORUS_SPEED
539 0 : GLfloat hyperspeedFactor;
540 : #endif
541 :
542 : // keys!
543 0 : NSDictionary *keyconfig2_settings;
544 0 : NSDictionary *keyCodeLookups;
545 :
546 0 : NSArray *n_key_roll_left;
547 0 : NSArray *n_key_roll_right;
548 0 : NSArray *n_key_pitch_forward;
549 0 : NSArray *n_key_pitch_back;
550 0 : NSArray *n_key_yaw_left;
551 0 : NSArray *n_key_yaw_right;
552 :
553 0 : NSArray *n_key_view_forward; // && undock
554 0 : NSArray *n_key_view_aft; // && options menu
555 0 : NSArray *n_key_view_port; // && equipment screen
556 0 : NSArray *n_key_view_starboard; // && interfaces screen
557 :
558 0 : NSArray *n_key_launch_ship;
559 0 : NSArray *n_key_gui_screen_options;
560 0 : NSArray *n_key_gui_screen_equipship;
561 0 : NSArray *n_key_gui_screen_interfaces;
562 0 : NSArray *n_key_gui_screen_status;
563 0 : NSArray *n_key_gui_chart_screens;
564 0 : NSArray *n_key_gui_system_data;
565 0 : NSArray *n_key_gui_market;
566 :
567 0 : NSArray *n_key_gui_arrow_left;
568 0 : NSArray *n_key_gui_arrow_right;
569 0 : NSArray *n_key_gui_arrow_up;
570 0 : NSArray *n_key_gui_arrow_down;
571 0 : NSArray *n_key_gui_page_up;
572 0 : NSArray *n_key_gui_page_down;
573 0 : NSArray *n_key_gui_select;
574 :
575 0 : NSArray *n_key_increase_speed;
576 0 : NSArray *n_key_decrease_speed;
577 0 : NSArray *n_key_inject_fuel;
578 :
579 0 : NSArray *n_key_fire_lasers;
580 0 : NSArray *n_key_launch_missile;
581 0 : NSArray *n_key_next_missile;
582 0 : NSArray *n_key_ecm;
583 :
584 0 : NSArray *n_key_prime_next_equipment;
585 0 : NSArray *n_key_prime_previous_equipment;
586 0 : NSArray *n_key_activate_equipment;
587 0 : NSArray *n_key_mode_equipment;
588 0 : NSArray *n_key_fastactivate_equipment_a;
589 0 : NSArray *n_key_fastactivate_equipment_b;
590 :
591 0 : NSArray *n_key_target_missile;
592 0 : NSArray *n_key_untarget_missile;
593 0 : NSArray *n_key_target_incoming_missile;
594 0 : NSArray *n_key_ident_system;
595 :
596 0 : NSArray *n_key_scanner_zoom;
597 0 : NSArray *n_key_scanner_unzoom;
598 :
599 0 : NSArray *n_key_launch_escapepod;
600 :
601 0 : NSArray *n_key_galactic_hyperspace;
602 0 : NSArray *n_key_hyperspace;
603 0 : NSArray *n_key_jumpdrive;
604 :
605 0 : NSArray *n_key_dump_cargo;
606 0 : NSArray *n_key_rotate_cargo;
607 :
608 0 : NSArray *n_key_autopilot;
609 0 : NSArray *n_key_autodock;
610 :
611 0 : NSArray *n_key_snapshot;
612 0 : NSArray *n_key_docking_music;
613 :
614 0 : NSArray *n_key_advanced_nav_array_next;
615 0 : NSArray *n_key_advanced_nav_array_previous;
616 0 : NSArray *n_key_info_next_system;
617 0 : NSArray *n_key_info_previous_system;
618 0 : NSArray *n_key_map_home;
619 0 : NSArray *n_key_map_end;
620 0 : NSArray *n_key_map_next_system;
621 0 : NSArray *n_key_map_previous_system;
622 0 : NSArray *n_key_map_info;
623 0 : NSArray *n_key_map_zoom_in;
624 0 : NSArray *n_key_map_zoom_out;
625 :
626 0 : NSArray *n_key_system_home;
627 0 : NSArray *n_key_system_end;
628 0 : NSArray *n_key_system_next_system;
629 0 : NSArray *n_key_system_previous_system;
630 :
631 0 : NSArray *n_key_pausebutton;
632 0 : NSArray *n_key_show_fps;
633 0 : NSArray *n_key_bloom_toggle;
634 0 : NSArray *n_key_mouse_control_roll;
635 0 : NSArray *n_key_mouse_control_yaw;
636 0 : NSArray *n_key_hud_toggle;
637 :
638 0 : NSArray *n_key_comms_log;
639 0 : NSArray *n_key_prev_compass_mode;
640 0 : NSArray *n_key_next_compass_mode;
641 :
642 0 : NSArray *n_key_chart_highlight;
643 0 : NSArray *n_key_market_filter_cycle;
644 0 : NSArray *n_key_market_sorter_cycle;
645 0 : NSArray *n_key_market_buy_one;
646 0 : NSArray *n_key_market_sell_one;
647 0 : NSArray *n_key_market_buy_max;
648 0 : NSArray *n_key_market_sell_max;
649 :
650 0 : NSArray *n_key_next_target;
651 0 : NSArray *n_key_previous_target;
652 :
653 0 : NSArray *n_key_custom_view;
654 0 : NSArray *n_key_custom_view_zoom_out;
655 0 : NSArray *n_key_custom_view_zoom_in;
656 0 : NSArray *n_key_custom_view_roll_left;
657 0 : NSArray *n_key_custom_view_pan_left;
658 0 : NSArray *n_key_custom_view_roll_right;
659 0 : NSArray *n_key_custom_view_pan_right;
660 0 : NSArray *n_key_custom_view_rotate_up;
661 0 : NSArray *n_key_custom_view_pan_up;
662 0 : NSArray *n_key_custom_view_rotate_down;
663 0 : NSArray *n_key_custom_view_pan_down;
664 0 : NSArray *n_key_custom_view_rotate_left;
665 0 : NSArray *n_key_custom_view_rotate_right;
666 :
667 0 : NSArray *n_key_docking_clearance_request;
668 0 : NSArray *n_key_weapons_online_toggle;
669 :
670 0 : NSArray *n_key_cycle_next_mfd;
671 0 : NSArray *n_key_cycle_previous_mfd;
672 0 : NSArray *n_key_switch_next_mfd;
673 0 : NSArray *n_key_switch_previous_mfd;
674 :
675 0 : NSArray *n_key_oxzmanager_setfilter;
676 0 : NSArray *n_key_oxzmanager_showinfo;
677 0 : NSArray *n_key_oxzmanager_extract;
678 :
679 : #if OO_FOV_INFLIGHT_CONTROL_ENABLED
680 : NSArray *n_key_inc_field_of_view;
681 : NSArray *n_key_dec_field_of_view;
682 : #endif
683 :
684 : #ifndef NDEBUG
685 0 : NSArray *n_key_dump_target_state;
686 0 : NSArray *n_key_dump_entity_list;
687 0 : NSArray *n_key_debug_full;
688 0 : NSArray *n_key_debug_collision;
689 0 : NSArray *n_key_debug_console_connect;
690 0 : NSArray *n_key_debug_bounding_boxes;
691 0 : NSArray *n_key_debug_shaders;
692 0 : NSArray *n_key_debug_off;
693 : #endif
694 :
695 : // dict to hold custom key config for OXP equipment with activate/mode functions
696 0 : NSMutableArray *customEquipActivation;
697 0 : NSMutableArray *customActivatePressed;
698 0 : NSMutableArray *customModePressed;
699 :
700 : // dict to hold extra keys for missions screen.
701 0 : NSDictionary *extraMissionKeys;
702 :
703 0 : NSMutableDictionary *extraGuiScreenKeys;
704 :
705 : // save-file
706 0 : NSString *save_path;
707 0 : NSString *scenarioKey;
708 :
709 : // position of viewports
710 0 : Vector forwardViewOffset, aftViewOffset, portViewOffset, starboardViewOffset;
711 0 : Vector _sysInfoLight;
712 :
713 : // trumbles
714 0 : NSUInteger trumbleCount;
715 0 : OOTrumble *trumble[PLAYER_MAX_TRUMBLES];
716 0 : float _trumbleAppetiteAccumulator;
717 :
718 : // smart zoom
719 0 : GLfloat scanner_zoom_rate;
720 :
721 : // target memory
722 : // TODO: this should use weakrefs
723 0 : NSMutableArray *target_memory;
724 0 : NSUInteger target_memory_index;
725 :
726 : // custom view points
727 0 : Quaternion customViewQuaternion;
728 0 : OOMatrix customViewMatrix;
729 0 : Vector customViewOffset, customViewForwardVector, customViewUpVector, customViewRightVector, customViewRotationCenter;
730 0 : NSString *customViewDescription;
731 :
732 :
733 : // docking reports
734 0 : NSMutableString *dockingReport;
735 :
736 : // Woo, flags.
737 0 : unsigned suppressTargetLost: 1, // smart target lst reports
738 0 : scoopsActive: 1, // smart fuelscoops
739 :
740 0 : scoopOverride: 1, //scripted to just be on, ignoring normal rules
741 0 : game_over: 1,
742 0 : finished: 1,
743 0 : bomb_detonated: 1,
744 0 : autopilot_engaged: 1,
745 :
746 0 : afterburner_engaged: 1,
747 0 : afterburnerSoundLooping: 1,
748 :
749 0 : hyperspeed_engaged: 1,
750 0 : travelling_at_hyperspeed: 1,
751 0 : hyperspeed_locked: 1,
752 :
753 0 : ident_engaged: 1,
754 :
755 0 : galactic_witchjump: 1,
756 :
757 0 : ecm_in_operation: 1,
758 :
759 0 : show_info_flag: 1,
760 :
761 0 : showDemoShips: 1,
762 :
763 0 : rolling, pitching, yawing: 1,
764 0 : using_mining_laser: 1,
765 :
766 0 : mouse_control_on: 1,
767 :
768 0 : keyboardRollOverride: 1, // Handle keyboard roll...
769 0 : keyboardPitchOverride: 1, // ...and pitch override separately - (fix for BUG #17490)
770 0 : keyboardYawOverride: 1,
771 0 : waitingForStickCallback: 1,
772 :
773 0 : weapons_online: 1,
774 :
775 0 : launchingMissile: 1,
776 0 : replacingMissile: 1,
777 :
778 0 : massLockable: 1;
779 : #if OOLITE_ESPEAK
780 : unsigned int voice_no;
781 : BOOL voice_gender_m;
782 : #endif
783 0 : OOSpeechSettings isSpeechOn;
784 :
785 :
786 : // For PlayerEntity (StickMapper)
787 0 : int selFunctionIdx;
788 0 : NSArray *stickFunctions;
789 0 : NSArray *keyFunctions;
790 0 : NSArray *kbdLayouts;
791 0 : NSString *keyShiftText;
792 0 : NSString *keyMod1Text;
793 0 : NSString *keyMod2Text;
794 :
795 0 : OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour;
796 0 : NSPoint galacticHyperspaceFixedCoords;
797 :
798 0 : OOLongRangeChartMode longRangeChartMode;
799 :
800 0 : NSArray *_customViews;
801 0 : NSUInteger _customViewIndex;
802 :
803 0 : OODockingClearanceStatus dockingClearanceStatus;
804 :
805 0 : NSMutableArray *scannedWormholes;
806 0 : WormholeEntity *wormhole;
807 :
808 0 : ShipEntity *demoShip; // Used while docked to maintain demo ship rotation.
809 0 : NSArray *lastShot; // used to correctly position laser shots on first frame of firing
810 :
811 0 : StickProfileScreen *stickProfileScreen;
812 :
813 0 : double maxFieldOfView;
814 0 : double fieldOfView;
815 : #if OO_FOV_INFLIGHT_CONTROL_ENABLED
816 : double fov_delta;
817 : #endif
818 : }
819 :
820 0 : + (PlayerEntity *) sharedPlayer;
821 0 : - (void) deferredInit;
822 :
823 0 : - (BOOL) setUpAndConfirmOK:(BOOL)stopOnError;
824 0 : - (BOOL) setUpAndConfirmOK:(BOOL)stopOnError saveGame:(BOOL)loadingGame;
825 0 : - (void) completeSetUp;
826 0 : - (void) completeSetUpAndSetTarget:(BOOL)setTarget;
827 0 : - (void) startUpComplete;
828 :
829 0 : - (NSString *) commanderName;
830 0 : - (void) setCommanderName:(NSString *)value;
831 0 : - (NSString *) lastsaveName;
832 0 : - (void) setLastsaveName:(NSString *)value;
833 :
834 0 : - (BOOL) isDocked;
835 :
836 0 : - (void) warnAboutHostiles;
837 :
838 0 : - (void) unloadCargoPods;
839 0 : - (void) loadCargoPods;
840 0 : - (void) unloadAllCargoPodsForType:(OOCommodityType)type toManifest:(OOCommodityMarket *) manifest;
841 0 : - (void) unloadCargoPodsForType:(OOCommodityType)type amount:(OOCargoQuantity) quantity;
842 0 : - (void) loadCargoPodsForType:(OOCommodityType)type fromManifest:(OOCommodityMarket *) manifest;
843 0 : - (void) loadCargoPodsForType:(OOCommodityType)type amount:(OOCargoQuantity) quantity;
844 0 : - (OOCommodityMarket *) shipCommodityData;
845 :
846 0 : - (OOCreditsQuantity) deciCredits;
847 :
848 0 : - (int) random_factor;
849 0 : - (void) setRandom_factor:(int)rf;
850 0 : - (OOGalaxyID) galaxyNumber;
851 0 : - (NSPoint) galaxy_coordinates;
852 0 : - (void) setGalaxyCoordinates:(NSPoint)newPosition;
853 0 : - (void) setCustomChartCentre:(NSPoint)coords;
854 0 : - (NSPoint) cursor_coordinates;
855 0 : - (NSPoint) chart_centre_coordinates;
856 0 : - (NSPoint) custom_chart_centre_coordinates;
857 0 : - (OOScalar) chart_zoom;
858 0 : - (OOScalar) custom_chart_zoom;
859 0 : - (void) setCustomChartZoom:(OOScalar)zoom;
860 0 : - (NSPoint) adjusted_chart_centre;
861 0 : - (OORouteType) ANAMode;
862 :
863 0 : - (NSString *) jumpCause;
864 0 : - (void) setJumpCause:(NSString *)value;
865 :
866 0 : - (OOSystemID) systemID;
867 0 : - (void) setSystemID:(OOSystemID) sid;
868 0 : - (OOSystemID) targetSystemID;
869 0 : - (void) setTargetSystemID:(OOSystemID) sid;
870 0 : - (OOSystemID) previousSystemID;
871 0 : - (void) setPreviousSystemID:(OOSystemID) sid;
872 0 : - (OOSystemID) nextHopTargetSystemID;
873 0 : - (OOSystemID) infoSystemID;
874 0 : - (void) setInfoSystemID: (OOSystemID) sid moveChart:(BOOL) moveChart;
875 0 : - (void) nextInfoSystem;
876 0 : - (void) previousInfoSystem;
877 0 : - (void) homeInfoSystem;
878 0 : - (void) targetInfoSystem;
879 0 : - (BOOL) infoSystemOnRoute;
880 :
881 :
882 0 : - (NSDictionary *) commanderDataDictionary;
883 0 : - (BOOL)setCommanderDataFromDictionary:(NSDictionary *) dict;
884 :
885 0 : - (void) addEquipmentWithScriptToCustomKeyArray:(NSString *)equipmentKey;
886 0 : - (void) validateCustomEquipActivationArray;
887 :
888 1 : - (void) doBookkeeping:(double) delta_t;
889 0 : - (BOOL) isValidTarget:(Entity*)target;
890 :
891 0 : - (void) setMassLockable:(BOOL)newValue;
892 0 : - (BOOL) massLockable;
893 0 : - (BOOL) massLocked;
894 0 : - (BOOL) atHyperspeed;
895 :
896 0 : - (float) occlusionLevel;
897 0 : - (void) setOcclusionLevel:(float)level;
898 :
899 0 : - (void) setDockedAtMainStation;
900 0 : - (StationEntity *) dockedStation;
901 : // Dumb setter; callers are responsible for sanity.
902 0 : - (void) setDockedStation:(StationEntity *)station;
903 :
904 0 : - (void) performDockingRequest:(StationEntity *)stationForDocking;
905 0 : - (void) requestDockingClearance:(StationEntity *)stationForDocking;
906 0 : - (void) cancelDockingRequest:(StationEntity *)stationForDocking;
907 0 : - (BOOL) engageAutopilotToStation:(StationEntity *)stationForDocking;
908 0 : - (void) disengageAutopilot;
909 :
910 0 : - (void) resetAutopilotAI;
911 :
912 0 : - (void) setTargetDockStationTo:(StationEntity *) value;
913 0 : - (StationEntity *) getTargetDockStation;
914 :
915 0 : - (HeadUpDisplay *) hud;
916 0 : - (BOOL) switchHudTo:(NSString *)hudFileName;
917 0 : - (void) resetHud;
918 :
919 0 : - (float) dialCustomFloat:(NSString *)dialKey;
920 0 : - (NSString *) dialCustomString:(NSString *)dialKey;
921 0 : - (OOColor *) dialCustomColor:(NSString *)dialKey;
922 0 : - (void) setDialCustom:(id)value forKey:(NSString *)key;
923 :
924 :
925 0 : - (NSArray *) multiFunctionDisplayList;
926 0 : - (NSString *) multiFunctionText:(NSUInteger) index;
927 0 : - (void) setMultiFunctionText:(NSString *)text forKey:(NSString *)key;
928 0 : - (BOOL) setMultiFunctionDisplay:(NSUInteger) index toKey:(NSString *)key;
929 0 : - (void) cycleNextMultiFunctionDisplay:(NSUInteger) index;
930 0 : - (void) cyclePreviousMultiFunctionDisplay:(NSUInteger) index;
931 0 : - (void) selectNextMultiFunctionDisplay;
932 0 : - (void) selectPreviousMultiFunctionDisplay;
933 0 : - (NSUInteger) activeMFD;
934 :
935 0 : - (void) setShowDemoShips:(BOOL) value;
936 0 : - (BOOL) showDemoShips;
937 :
938 0 : - (GLfloat) forwardShieldLevel;
939 0 : - (GLfloat) aftShieldLevel;
940 0 : - (GLfloat) baseMass;
941 :
942 0 : - (void) setForwardShieldLevel:(GLfloat)level;
943 0 : - (void) setAftShieldLevel:(GLfloat)level;
944 :
945 0 : - (float) forwardShieldRechargeRate;
946 0 : - (float) aftShieldRechargeRate;
947 :
948 0 : - (void) setMaxForwardShieldLevel:(float)new;
949 0 : - (void) setMaxAftShieldLevel:(float)new;
950 0 : - (void) setForwardShieldRechargeRate:(float)new;
951 0 : - (void) setAftShieldRechargeRate:(float)new;
952 :
953 : // return keyconfig.plist settings for scripting
954 0 : - (NSDictionary *) keyConfig;
955 0 : - (BOOL) isMouseControlOn;
956 :
957 0 : - (GLfloat) dialRoll;
958 0 : - (GLfloat) dialPitch;
959 0 : - (GLfloat) dialYaw;
960 0 : - (GLfloat) dialSpeed;
961 0 : - (GLfloat) dialHyperSpeed;
962 :
963 0 : - (void) currentWeaponStats;
964 :
965 0 : - (GLfloat) dialForwardShield;
966 0 : - (GLfloat) dialAftShield;
967 :
968 0 : - (GLfloat) dialEnergy;
969 0 : - (GLfloat) dialMaxEnergy;
970 :
971 0 : - (GLfloat) dialFuel;
972 0 : - (GLfloat) dialHyperRange;
973 :
974 0 : - (GLfloat) dialAltitude;
975 :
976 0 : - (unsigned) countMissiles;
977 0 : - (OOMissileStatus) dialMissileStatus;
978 :
979 0 : - (OOFuelScoopStatus) dialFuelScoopStatus;
980 :
981 0 : - (float) fuelLeakRate;
982 0 : - (void) setFuelLeakRate:(float)value;
983 :
984 : #if OO_VARIABLE_TORUS_SPEED
985 0 : - (GLfloat) hyperspeedFactor;
986 : #endif
987 0 : - (BOOL) injectorsEngaged;
988 0 : - (BOOL) hyperspeedEngaged;
989 :
990 0 : - (NSMutableArray *) customEquipmentActivation;
991 :
992 :
993 0 : - (double) clockTime; // Note that this is not an OOTimeAbsolute
994 0 : - (double) clockTimeAdjusted; // Note that this is not an OOTimeAbsolute
995 0 : - (BOOL) clockAdjusting;
996 0 : - (void) addToAdjustTime:(double) seconds ;
997 :
998 0 : - (double) escapePodRescueTime;
999 0 : - (void) setEscapePodRescueTime:(double) seconds;
1000 :
1001 0 : - (NSString *) dial_clock;
1002 0 : - (NSString *) dial_clock_adjusted;
1003 0 : - (NSString *) dial_fpsinfo;
1004 0 : - (NSString *) dial_objinfo;
1005 :
1006 0 : - (NSMutableArray *) commLog;
1007 :
1008 0 : - (Entity *) compassTarget;
1009 0 : - (void) setCompassTarget:(Entity *)value;
1010 0 : - (void) validateCompassTarget;
1011 :
1012 0 : - (NSString *) compassTargetLabel;
1013 :
1014 0 : - (OOCompassMode) compassMode;
1015 0 : - (void) setCompassMode:(OOCompassMode)value;
1016 0 : - (void) setPrevCompassMode;
1017 0 : - (void) setNextCompassMode;
1018 :
1019 0 : - (NSUInteger) activeMissile;
1020 0 : - (void) setActiveMissile:(NSUInteger)value;
1021 0 : - (NSUInteger) dialMaxMissiles;
1022 0 : - (BOOL) dialIdentEngaged;
1023 0 : - (void) setDialIdentEngaged:(BOOL)newValue;
1024 0 : - (NSString *) specialCargo;
1025 0 : - (NSString *) dialTargetName;
1026 0 : - (ShipEntity *) missileForPylon:(NSUInteger)value;
1027 0 : - (void) safeAllMissiles;
1028 0 : - (void) selectNextMissile;
1029 0 : - (void) tidyMissilePylons;
1030 0 : - (BOOL) removeFromPylon:(NSUInteger) pylon;
1031 0 : - (BOOL) assignToActivePylon:(NSString *)identifierKey;
1032 :
1033 0 : - (void) clearAlertFlags;
1034 0 : - (int) alertFlags;
1035 0 : - (void) setAlertFlag:(int)flag to:(BOOL)value;
1036 0 : - (OOAlertCondition) alertCondition;
1037 0 : - (OOPlayerFleeingStatus) fleeingStatus;
1038 :
1039 0 : - (BOOL) mountMissile:(ShipEntity *)missile;
1040 0 : - (BOOL) mountMissileWithRole:(NSString *)role;
1041 :
1042 0 : - (OOEnergyUnitType) installedEnergyUnitType;
1043 0 : - (OOEnergyUnitType) energyUnitType;
1044 :
1045 0 : - (ShipEntity *) launchMine:(ShipEntity *)mine;
1046 :
1047 0 : - (BOOL) activateCloakingDevice;
1048 0 : - (void) deactivateCloakingDevice;
1049 :
1050 0 : - (double) scannerFuzziness;
1051 :
1052 0 : - (BOOL) weaponsOnline;
1053 0 : - (void) setWeaponsOnline:(BOOL)newValue;
1054 :
1055 0 : - (BOOL) fireMainWeapon;
1056 :
1057 0 : - (OOWeaponType) weaponForFacing:(OOWeaponFacing)facing;
1058 0 : - (OOWeaponType) currentWeapon;
1059 0 : - (NSArray *) currentLaserOffset;
1060 :
1061 0 : - (void) rotateCargo;
1062 :
1063 0 : - (BOOL) hasSufficientFuelForJump;
1064 :
1065 0 : - (BOOL) witchJumpChecklist:(BOOL)isGalacticJump;
1066 0 : - (void) enterGalacticWitchspace;
1067 0 : - (void) setJumpType:(BOOL)isGalacticJump;
1068 :
1069 0 : - (BOOL) takeInternalDamage;
1070 :
1071 0 : - (BOOL) endScenario:(NSString *)key;
1072 :
1073 0 : - (NSMutableArray *) roleWeights;
1074 0 : - (void) addRoleForAggression:(ShipEntity *)victim;
1075 0 : - (void) addRoleForMining;
1076 0 : - (void) addRoleToPlayer:(NSString *)role;
1077 0 : - (void) addRoleToPlayer:(NSString *)role inSlot:(NSUInteger)slot;
1078 0 : - (void) clearRoleFromPlayer:(BOOL)includingLongRange;
1079 0 : - (void) clearRolesFromPlayer:(float)chance;
1080 0 : - (NSUInteger) maxPlayerRoles;
1081 0 : - (void) updateSystemMemory;
1082 :
1083 0 : - (void) loseTargetStatus;
1084 :
1085 0 : - (void) docked;
1086 :
1087 0 : - (void) setGuiToStatusScreen;
1088 0 : - (NSArray *) equipmentList; // Each entry is an array with a string followed by a boolean indicating availability (NO = damaged), then a color (or nil for default color).
1089 0 : - (BOOL) setPrimedEquipment:(NSString *)eqKey showMessage:(BOOL)showMsg;
1090 0 : - (NSString *) primedEquipmentName:(NSInteger)offset;
1091 0 : - (NSString *) currentPrimedEquipment;
1092 0 : - (NSUInteger) primedEquipmentCount;
1093 0 : - (void) activatePrimableEquipment:(NSUInteger)index withMode:(OOPrimedEquipmentMode)mode;
1094 0 : - (NSString *) fastEquipmentA;
1095 0 : - (NSString *) fastEquipmentB;
1096 0 : - (void) setFastEquipmentA:(NSString *)eqKey;
1097 0 : - (void) setFastEquipmentB:(NSString *)eqKey;
1098 :
1099 0 : - (OOCreditsQuantity) adjustPriceByScriptForEqKey:(NSString *)eqKey withCurrent:(OOCreditsQuantity)price;
1100 :
1101 0 : - (NSArray *) cargoList;
1102 : //- (NSArray *) cargoListForScripting; // now in ShipEntity
1103 0 : - (unsigned) legalStatusOfCargoList;
1104 :
1105 0 : - (void) setGuiToSystemDataScreen;
1106 0 : - (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground;
1107 0 : - (NSDictionary *) markedDestinations;
1108 0 : - (void) setGuiToLongRangeChartScreen;
1109 0 : - (void) setGuiToShortRangeChartScreen;
1110 0 : - (void) setGuiToChartScreenFrom: (OOGUIScreenID) oldScreen;
1111 0 : - (void) setGuiToLoadSaveScreen;
1112 0 : - (void) setGuiToGameOptionsScreen;
1113 0 : - (OOWeaponFacingSet) availableFacings;
1114 0 : - (void) setGuiToEquipShipScreen:(int)skip selectingFacingFor:(NSString *)eqKeyForSelectFacing;
1115 0 : - (void) setGuiToEquipShipScreen:(int)skip;
1116 :
1117 0 : - (void) setGuiToInterfacesScreen:(int)skip;
1118 0 : - (void) showInformationForSelectedInterface;
1119 0 : - (void) activateSelectedInterface;
1120 :
1121 0 : - (void) highlightEquipShipScreenKey:(NSString *)key;
1122 0 : - (void) showInformationForSelectedUpgrade;
1123 0 : - (void) showInformationForSelectedUpgradeWithFormatString:(NSString *)extraString;
1124 0 : - (BOOL) setWeaponMount:(OOWeaponFacing)chosen_weapon_facing toWeapon:(NSString *)eqKey;
1125 0 : - (BOOL) setWeaponMount:(OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context;
1126 :
1127 0 : - (BOOL) changePassengerBerths:(int) addRemove;
1128 0 : - (OOCargoQuantity) cargoQuantityForType:(OOCommodityType)type;
1129 0 : - (OOCargoQuantity) setCargoQuantityForType:(OOCommodityType)type amount:(OOCargoQuantity)amount;
1130 0 : - (void) calculateCurrentCargo;
1131 0 : - (void) setGuiToMarketScreen;
1132 0 : - (void) setGuiToMarketInfoScreen;
1133 0 : - (NSArray *) applyMarketFilter:(NSArray *)goods onMarket:(OOCommodityMarket *)market;
1134 0 : - (NSArray *) applyMarketSorter:(NSArray *)goods onMarket:(OOCommodityMarket *)market;
1135 0 : - (OOCommodityMarket *) localMarket;
1136 :
1137 :
1138 0 : - (void) setupStartScreenGui;
1139 1 : - (void) setGuiToIntroFirstGo:(BOOL)justCobra;
1140 0 : - (void) setGuiToOXZManager;
1141 :
1142 0 : - (void) noteGUIWillChangeTo:(OOGUIScreenID)toScreen;
1143 0 : - (void) noteGUIDidChangeFrom:(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen refresh: (BOOL) refresh;
1144 0 : - (void) noteGUIDidChangeFrom:(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen;
1145 0 : - (void) noteViewDidChangeFrom:(OOViewID)fromView toView:(OOViewID)toView;
1146 :
1147 0 : - (OOGUIScreenID) guiScreen;
1148 :
1149 0 : - (void) buySelectedItem;
1150 :
1151 0 : - (BOOL) tryBuyingCommodity:(OOCommodityType)type all:(BOOL)all;
1152 0 : - (BOOL) trySellingCommodity:(OOCommodityType)type all:(BOOL)all;
1153 :
1154 0 : - (OOSpeechSettings) isSpeechOn;
1155 :
1156 0 : - (void) addEquipmentFromCollection:(id)equipment; // equipment may be an array, a set, a dictionary whose values are all YES, or a string.
1157 :
1158 0 : - (void) getFined;
1159 0 : - (void) adjustTradeInFactorBy:(int)value;
1160 0 : - (int) tradeInFactor;
1161 0 : - (double) renovationCosts;
1162 0 : - (double) renovationFactor;
1163 :
1164 :
1165 0 : - (void) setDefaultViewOffsets;
1166 0 : - (void) setDefaultCustomViews;
1167 0 : - (Vector) weaponViewOffset;
1168 :
1169 0 : - (void) setUpTrumbles;
1170 0 : - (void) addTrumble:(OOTrumble *)papaTrumble;
1171 0 : - (void) removeTrumble:(OOTrumble *)deadTrumble;
1172 0 : - (OOTrumble **) trumbleArray;
1173 0 : - (NSUInteger) trumbleCount;
1174 : // loading and saving trumbleCount
1175 0 : - (id) trumbleValue;
1176 0 : - (void) setTrumbleValueFrom:(NSObject *)trumbleValue;
1177 :
1178 0 : - (float) trumbleAppetiteAccumulator;
1179 0 : - (void) setTrumbleAppetiteAccumulator:(float)value;
1180 :
1181 0 : - (void) mungChecksumWithNSString:(NSString *)str;
1182 :
1183 0 : - (NSString *)screenModeStringForWidth:(unsigned)inWidth height:(unsigned)inHeight refreshRate:(float)inRate;
1184 :
1185 0 : - (void) suppressTargetLost;
1186 :
1187 0 : - (void) setScoopsActive;
1188 :
1189 0 : - (void) clearTargetMemory;
1190 0 : - (NSMutableArray *) targetMemory;
1191 0 : - (BOOL) moveTargetMemoryBy:(NSInteger)delta;
1192 :
1193 0 : - (void) printIdentLockedOnForMissile:(BOOL)missile;
1194 :
1195 0 : - (void) applyYaw:(GLfloat) yaw;
1196 :
1197 : /* GILES custom viewpoints */
1198 :
1199 : // custom view points
1200 0 : - (Quaternion)customViewQuaternion;
1201 0 : - (void)setCustomViewQuaternion:(Quaternion)q1;
1202 0 : - (OOMatrix)customViewMatrix;
1203 0 : - (Vector)customViewOffset;
1204 0 : - (void)setCustomViewOffset:(Vector)offset;
1205 0 : - (Vector)customViewRotationCenter;
1206 0 : - (void)setCustomViewRotationCenter:(Vector)center;
1207 0 : - (void)customViewZoomOut:(OOScalar) rate;
1208 0 : - (void)customViewZoomIn: (OOScalar) rate;
1209 0 : - (void)customViewRotateLeft:(OOScalar) angle;
1210 0 : - (void)customViewRotateRight:(OOScalar) angle;
1211 0 : - (void)customViewRotateUp:(OOScalar) angle;
1212 0 : - (void)customViewRotateDown:(OOScalar) angle;
1213 0 : - (void)customViewRollLeft:(OOScalar) angle;
1214 0 : - (void)customViewRollRight:(OOScalar) angle;
1215 0 : - (void)customViewPanUp:(OOScalar) angle;
1216 0 : - (void)customViewPanDown:(OOScalar) angle;
1217 0 : - (void)customViewPanLeft:(OOScalar) angle;
1218 0 : - (void)customViewPanRight:(OOScalar) angle;
1219 0 : - (Vector)customViewForwardVector;
1220 0 : - (Vector)customViewUpVector;
1221 0 : - (Vector)customViewRightVector;
1222 0 : - (NSString *)customViewDescription;
1223 0 : - (void)resetCustomView;
1224 0 : - (void)setCustomViewData;
1225 0 : - (void)setCustomViewDataFromDictionary:(NSDictionary*) viewDict withScaling:(BOOL)withScaling;
1226 0 : - (HPVector) viewpointPosition;
1227 0 : - (HPVector) breakPatternPosition;
1228 0 : - (Vector) viewpointOffset;
1229 0 : - (Vector) viewpointOffsetAft;
1230 0 : - (Vector) viewpointOffsetForward;
1231 0 : - (Vector) viewpointOffsetPort;
1232 0 : - (Vector) viewpointOffsetStarboard;
1233 :
1234 :
1235 0 : - (NSDictionary *) missionOverlayDescriptor;
1236 0 : - (NSDictionary *) missionOverlayDescriptorOrDefault;
1237 0 : - (void) setMissionOverlayDescriptor:(NSDictionary *)descriptor;
1238 :
1239 0 : - (NSDictionary *) missionBackgroundDescriptor;
1240 0 : - (NSDictionary *) missionBackgroundDescriptorOrDefault;
1241 0 : - (void) setMissionBackgroundDescriptor:(NSDictionary *)descriptor;
1242 0 : - (OOGUIBackgroundSpecial) missionBackgroundSpecial;
1243 0 : - (void) setMissionBackgroundSpecial:(NSString *)special;
1244 0 : - (void) setMissionExitScreen:(OOGUIScreenID)screen;
1245 0 : - (OOGUIScreenID) missionExitScreen;
1246 0 : - (void) clearExtraMissionKeys;
1247 0 : - (void) setExtraMissionKeys:(NSDictionary *)keys;
1248 :
1249 0 : - (void) clearExtraGuiScreenKeys:(OOGUIScreenID)gui key:(NSString *)key;
1250 1 : - (BOOL) setExtraGuiScreenKeys:(OOGUIScreenID)gui definition:(OOJSGuiScreenKeyDefinition *)definition;
1251 :
1252 :
1253 : // Nasty hack to keep background textures around while on equip screens.
1254 0 : - (NSDictionary *) equipScreenBackgroundDescriptor;
1255 0 : - (void) setEquipScreenBackgroundDescriptor:(NSDictionary *)descriptor;
1256 :
1257 0 : - (BOOL) scriptsLoaded;
1258 0 : - (NSArray *) worldScriptNames;
1259 0 : - (NSDictionary *) worldScriptsByName;
1260 :
1261 0 : - (OOScript *) commodityScriptNamed:(NSString *)script;
1262 :
1263 : // *** World script events.
1264 : // In general, script events should be sent through doScriptEvent:..., which
1265 : // will forward to the world scripts.
1266 0 : - (BOOL) doWorldEventUntilMissionScreen:(jsid)message;
1267 0 : - (void) doWorldScriptEvent:(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc timeLimit:(OOTimeDelta)limit;
1268 :
1269 0 : - (BOOL)showInfoFlag;
1270 :
1271 0 : - (void) setGalacticHyperspaceBehaviour:(OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour;
1272 0 : - (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour;
1273 0 : - (void) setGalacticHyperspaceFixedCoords:(NSPoint)point;
1274 0 : - (void) setGalacticHyperspaceFixedCoordsX:(unsigned char)x y:(unsigned char)y;
1275 0 : - (NSPoint) galacticHyperspaceFixedCoords;
1276 0 : - (void) setWitchspaceCountdown:(int)spin_time;
1277 :
1278 0 : - (OOLongRangeChartMode) longRangeChartMode;
1279 0 : - (void) setLongRangeChartMode:(OOLongRangeChartMode) mode;
1280 :
1281 0 : - (BOOL) scoopOverride;
1282 0 : - (void) setScoopOverride:(BOOL)newValue;
1283 0 : - (void) setDockTarget:(ShipEntity *)entity;
1284 :
1285 0 : - (BOOL) clearedToDock;
1286 0 : - (void) setDockingClearanceStatus:(OODockingClearanceStatus) newValue;
1287 0 : - (OODockingClearanceStatus) getDockingClearanceStatus;
1288 0 : - (void) penaltyForUnauthorizedDocking;
1289 :
1290 0 : - (NSArray *) scannedWormholes;
1291 :
1292 0 : - (WormholeEntity *) wormhole;
1293 0 : - (void) setWormhole:(WormholeEntity *)newWormhole;
1294 0 : - (void) addScannedWormhole:(WormholeEntity*)wormhole;
1295 :
1296 0 : - (void) initialiseMissionDestinations:(NSDictionary *)destinations andLegacy:(NSArray *)legacy;
1297 0 : - (NSString *)markerKey:(NSDictionary*)marker;
1298 0 : - (void) addMissionDestinationMarker:(NSDictionary *)marker;
1299 0 : - (BOOL) removeMissionDestinationMarker:(NSDictionary *)marker;
1300 0 : - (NSMutableDictionary*) getMissionDestinations;
1301 :
1302 0 : - (NSMutableDictionary*) shipyardRecord;
1303 :
1304 0 : - (void) setLastShot:(NSArray *)shot;
1305 :
1306 0 : - (void) showShipModelWithKey:(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context;
1307 :
1308 0 : - (void) doGuiScreenResizeUpdates;
1309 :
1310 : /* Fractional expression of amount of entry inside a planet's atmosphere. 0.0f is out of atmosphere,
1311 : 1.0f is fully in and is normally associated with the point of ship destruct due to altitude.
1312 : */
1313 0 : - (GLfloat) insideAtmosphereFraction;
1314 :
1315 : @end
1316 :
1317 :
1318 : /* Use PLAYER to refer to the shared player object in cases where it is
1319 : assumed to exist (i.e., except during early initialization).
1320 : */
1321 : OOINLINE PlayerEntity *OOGetPlayer(void) INLINE_CONST_FUNC;
1322 0 : OOINLINE PlayerEntity *OOGetPlayer(void)
1323 : {
1324 : extern PlayerEntity *gOOPlayer;
1325 : #if OO_DEBUG
1326 : NSCAssert(gOOPlayer != nil, @"PLAYER used when [PlayerEntity sharedPlayer] has not been called.");
1327 : #endif
1328 : return gOOPlayer;
1329 : }
1330 0 : #define PLAYER OOGetPlayer()
1331 :
1332 0 : #define KILOGRAMS_PER_POD 1000
1333 0 : #define MAX_KILOGRAMS_IN_SAFE ((KILOGRAMS_PER_POD / 2) - 1)
1334 0 : #define GRAMS_PER_POD (KILOGRAMS_PER_POD * 1000)
1335 0 : #define MAX_GRAMS_IN_SAFE ((GRAMS_PER_POD / 2) - 1)
1336 :
1337 :
1338 0 : NSString *OODisplayRatingStringFromKillCount(unsigned kills);
1339 0 : NSString *KillCountToRatingAndKillString(unsigned kills);
1340 0 : NSString *OODisplayStringFromLegalStatus(int legalStatus);
1341 :
1342 0 : NSString *OOStringFromGUIScreenID(OOGUIScreenID screen) CONST_FUNC;
1343 0 : OOGUIScreenID OOGUIScreenIDFromString(NSString *string) PURE_FUNC;
1344 :
1345 0 : OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromString(NSString *string) PURE_FUNC;
1346 0 : NSString *OOStringFromGalacticHyperspaceBehaviour(OOGalacticHyperspaceBehaviour behaviour) CONST_FUNC;
|