49#import "MyOpenGLView.h"
90#define PLAYER_DEFAULT_NAME @"Jameson"
113@interface PlayerEntity (OOPrivate)
116- (void) doTradeIn:(
OOCreditsQuantity)tradeInValue forPriceFactor:(
double)priceFactor;
125- (void) performAutopilotUpdates:(
OOTimeDelta)delta_t;
126- (void) performInFlightUpdates:(
OOTimeDelta)delta_t;
127- (void) performWitchspaceCountdownUpdates:(
OOTimeDelta)delta_t;
128- (void) performWitchspaceExitUpdates:(
OOTimeDelta)delta_t;
129- (void) performLaunchingUpdates:(
OOTimeDelta)delta_t;
130- (void) performDockingUpdates:(
OOTimeDelta)delta_t;
138- (BOOL) checkEntityForMassLock:(
Entity *)ent withScanClass:(
int)scanClass;
147- (BOOL) tryBuyingItem:(NSString *)eqKey;
150- (NSArray*) contractsListForScriptingFromArray:(NSArray *)contractsArray forCargo:(BOOL)forCargo;
153- (void) prepareMarkedDestination:(NSMutableDictionary *)markers :(NSDictionary *)marker;
156- (void) witchJumpTo:(
OOSystemID)sTo misjump:(BOOL)misjump;
170@interface ShipEntity (Hax)
189- (void) setName:(NSString *)inName
189- (void) setName:(NSString *)inName {
…}
200 if ([
self mass] > 0.0)
202 OOLog(
@"fuelPrices",
@"Setting Cobra3 base mass to: %.2f ", [
self mass]);
208 OOLog(
@"fuelPrices",
@"%@",
@"Player ship not initialised properly yet, using precalculated base mass.");
219 NSInteger i, cargoCount = [cargo count];
220 if (cargoCount == 0)
return;
223 for (i = cargoCount - 1; i >= 0 ; i--)
225 ShipEntity *cargoItem = [cargo objectAtIndex:i];
236 OOLog(
@"player.badCargoPod",
@"Cargo pod %@ has bad commodity type, rejecting.", cargoItem);
239 [cargo removeObjectAtIndex:i];
247 NSInteger i, n_cargo = [cargo count];
248 if (n_cargo == 0)
return;
256 for (i = n_cargo - 1; (i >= 0 && cargoToGo > 0) ; i--)
258 cargoItem = [cargo objectAtIndex:i];
260 if (co_type ==
nil || [co_type isEqualToString:type])
262 if ([co_type isEqualToString:type])
265 if (amount <= cargoToGo)
267 [cargo removeObjectAtIndex:i];
280 OOLog(
@"player.badCargoPod",
@"Cargo pod %@ has bad commodity type (COMMODITY_UNDEFINED), rejecting.", cargoItem);
296 NSAssert([
self isDocked],
@"Cannot unload cargo pods unless docked.");
299 NSString *good =
nil;
307 OOLog(
@"player.unloadCargo",
@"Cargo remains in pods after unloading - %@",
cargo);
318 ShipEntity *container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
324 [cargo addObject:container];
329 OOLogERR(
@"player.loadCargoPods.noContainer",
@"%@",
@"couldn't create a container in [PlayerEntity loadCargoPods]");
332 format:@"[PlayerEntity loadCargoPods] failed to create a container for cargo with role 'cargopod'"];
350 for (j = 0; j < quantity; j++)
358 OOCargoQuantity podsRequiredForQuantity, amountToLoadInCargopod, tmpQuantity;
364 tmpQuantity = quantity;
370 quantity -= tmpQuantity;
377 tmpQuantity = quantity;
383 quantity -= tmpQuantity;
389 podsRequiredForQuantity = 1 + (quantity/amountToLoadInCargopod);
392 if (quantity % amountToLoadInCargopod == 0) podsRequiredForQuantity--;
395 for (j = 0; j < podsRequiredForQuantity; j++)
397 if (amountToLoadInCargopod > quantity)
400 amountToLoadInCargopod = quantity;
403 quantity -= amountToLoadInCargopod;
424 int smaller_quantity = 1 + ((quantity - 1) % amount_per_container);
427 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
434 [cargo addObject:container];
447 quantity -= smaller_quantity;
457 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
464 [cargo addObject:container];
478 NSString *good =
nil;
506- (void) setRandom_factor:(
int)rf
506- (void) setRandom_factor:(
int)rf {
…}
524- (void) setGalaxyCoordinates:(NSPoint)newPosition
524- (void) setGalaxyCoordinates:(NSPoint)newPosition {
…}
583- (void) setCustomChartCentre:(NSPoint)coords
583- (void) setCustomChartCentre:(NSPoint)coords {
…}
606 return NSMakePoint(128.0, 128.0);
639 if (scroll_pos >= 256.0)
665 if (scroll_pos >= 256.0)
728 if (![
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
742 NSDictionary *routeInfo =
nil;
743 routeInfo = [UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode];
745 if (routeInfo ==
nil)
749 return [[
routeInfo oo_arrayForKey:@"route"] oo_intAtIndex:1];
759- (void) setInfoSystemID: (
OOSystemID) sid moveChart: (BOOL) moveChart
771 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
782 chart_centre_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
759- (void) setInfoSystemID: (
OOSystemID) sid moveChart: (BOOL) moveChart {
…}
801 NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
808 for (i = 0; i < [
route count]; i++)
812 if (i + 1 < [route
count])
834 NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
841 for (i = 0; i < [
route count]; i++)
876 NSArray *route = [[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"];
882 for (i = 0; i < [
route count]; i++)
902 if (newWormhole !=
nil)
919 [
result setObject:[[[
NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"written_by_version"];
921 NSString *gal_id = [
NSString stringWithFormat:@"%u", galaxy_number];
922 NSString *sys_id = [
NSString stringWithFormat:@"%d", system_id];
923 NSString *tgt_id = [
NSString stringWithFormat:@"%d", target_system_id];
924 NSString *prv_id = [
NSString stringWithFormat:@"%d", previous_system_id];
930 [
result setObject:gal_id forKey:@"galaxy_id"];
931 [
result setObject:sys_id forKey:@"system_id"];
932 [
result setObject:tgt_id forKey:@"target_id"];
933 [
result setObject:prv_id forKey:@"previous_system_id"];
934 [
result setObject:[
NSNumber numberWithFloat:saved_chart_zoom] forKey:@"chart_zoom"];
935 [
result setObject:[
NSNumber numberWithInt:ANA_mode] forKey:@"chart_ana_mode"];
936 [
result setObject:[
NSNumber numberWithInt:longRangeChartMode] forKey:@"chart_colour_mode"];
941 NSString *found_id = [
NSString stringWithFormat:@"%d", found_system_id];
942 [
result setObject:found_id forKey:@"found_system_id"];
946 if (![
UNIVERSE inInterstellarSpace])
949 OOGovernmentID government = [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
950 OOTechLevelID techlevel = [[UNIVERSE currentSystemData] oo_intForKey:KEY_TECHLEVEL];
951 OOEconomyID economy = [[UNIVERSE currentSystemData] oo_intForKey:KEY_ECONOMY];
952 [
result setObject:[
NSNumber numberWithUnsignedShort:government] forKey:@"current_system_government"];
953 [
result setObject:[
NSNumber numberWithUnsignedInteger:techlevel] forKey:@"current_system_techlevel"];
954 [
result setObject:[
NSNumber numberWithUnsignedShort:economy] forKey:@"current_system_economy"];
969 [
result oo_setFloat:credits forKey:@"credits"];
970 [
result oo_setUnsignedInteger:fuel forKey:@"fuel"];
972 [
result oo_setInteger:galaxy_number forKey:@"galaxy_number"];
993 if (
hud !=
nil && [
hud nonlinearScanner])
998 [
result oo_setInteger:max_cargo + PASSENGER_BERTH_SPACE * max_passengers forKey:@"max_cargo"];
1003 NSMutableArray *missileRoles = [
NSMutableArray arrayWithCapacity:max_missiles];
1016 [
result setObject:missileRoles forKey:@"missile_roles"];
1018 [
result oo_setInteger:missiles forKey:@"missiles"];
1020 [
result oo_setInteger:legalStatus forKey:@"legal_status"];
1021 [
result oo_setInteger:market_rnd forKey:@"market_rnd"];
1022 [
result oo_setInteger:ship_kills forKey:@"ship_kills"];
1025 [
result oo_setInteger:ship_trade_in_factor forKey:@"ship_trade_in_factor"];
1030 [
result setObject:[
NSDictionary dictionaryWithDictionary:mission_variables] forKey:@"mission_variables"];
1034 NSArray *log = [
self commLog];
1035 if (log !=
nil) [
result setObject:log forKey:@"comm_log"];
1037 [
result oo_setUnsignedInteger:entity_personality forKey:@"entity_personality"];
1041 NSEnumerator *eqEnum =
nil;
1042 NSString *eqDesc =
nil;
1047 if ([equipment
count] != 0)
1049 [
result setObject:equipment forKey:@"extra_equipment"];
1057 [
result setObject:roleWeights forKey:@"role_weights"];
1060 [
result setObject:roleWeightFlags forKey:@"role_weight_flags"];
1063 [
result setObject:roleSystemList forKey:@"role_system_memory"];
1066 [
result setObject:reputation forKey:@"reputation"];
1069 int pGood = [reputation oo_intForKey:PARCEL_GOOD_KEY];
1070 int pBad = [reputation oo_intForKey:PARCEL_BAD_KEY];
1071 int pUnknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
1074 [reputation oo_setInteger:0 forKey:PARCEL_GOOD_KEY];
1075 [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
1076 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
1080 [
result oo_setInteger:max_passengers forKey:@"max_passengers"];
1081 [
result setObject:passengers forKey:@"passengers"];
1082 [
result setObject:passenger_record forKey:@"passenger_record"];
1085 [
result setObject:parcels forKey:@"parcels"];
1086 [
result setObject:parcel_record forKey:@"parcel_record"];
1092 [
result setObject:contracts forKey:@"contracts"];
1093 [
result setObject:contract_record forKey:@"contract_record"];
1095 [
result setObject:missionDestinations forKey:@"mission_destinations"];
1098 [
result setObject:shipyard_record forKey:@"shipyard_record"];
1101 [
result setObject:[
NSNumber numberWithDouble:ship_clock] forKey:@"ship_clock"];
1104 [
result setObject:[
NSNumber numberWithInt:isSpeechOn] forKey:@"speech_on"];
1106 [
result setObject:[UNIVERSE voiceName:voice_no] forKey:@"speech_voice"];
1107 [
result setObject:[
NSNumber numberWithBool:voice_gender_m] forKey:@"speech_gender"];
1111 [
result setObject:[
NSNumber numberWithBool:[UNIVERSE dockingClearanceProtocolActive]] forKey:@"docking_clearance_protocol"];
1118 [
result oo_setUnsignedInteger:_customViewIndex forKey:@"custom_view_index"];
1124 if ([[
UNIVERSE station]
localMarket]) [
result setObject:[[[UNIVERSE station] localMarket] saveStationAmounts] forKey:@"localMarket"];
1127 [
result setObject:[UNIVERSE useAddOns] forKey:@"scenario_restriction"];
1129 [
result setObject:[[UNIVERSE systemManager] exportScriptedChanges] forKey:@"scripted_planetinfo_overrides"];
1135 NSMutableArray *wormholeDicts = [
NSMutableArray arrayWithCapacity:[scannedWormholes count]];
1136 NSEnumerator *wormholes = [scannedWormholes objectEnumerator];
1138 foreach(wh, wormholes)
1142 [
result setObject:wormholeDicts forKey:@"wormholes"];
1150 [
result setObject:ArrayFromHPVector(dpos) forKey:@"docked_station_position"];
1154 [
result setObject:[
NSArray array] forKey:@"docked_station_position"];
1156 [
result setObject:[UNIVERSE getStationMarkets] forKey:@"station_markets"];
1161 [
result setObject:scenarioKey forKey:@"scenario"];
1178 if (equipment !=
nil)
1186 [
result oo_setInteger:final_checksum forKey:@"checksum"];
1192- (BOOL)setCommanderDataFromDictionary:(NSDictionary *) dict
1196 [multiFunctionDisplayText release];
1199 [multiFunctionDisplaySettings release];
1202 [customDialSettings release];
1205 [[UNIVERSE gameView] resetTypedString];
1208 if ([dict oo_stringForKey:
@"ship_desc"] ==
nil)
return NO;
1210 if ([dict oo_stringForKey:
@"galaxy_seed"] ==
nil && [dict oo_stringForKey:
@"galaxy_id"] ==
nil)
return NO;
1212 if ([dict oo_stringForKey:
@"galaxy_coordinates"] ==
nil && [dict oo_stringForKey:
@"system_id"] ==
nil)
return NO;
1214 NSString *scenarioRestrict = [
dict oo_stringForKey:@"scenario_restriction" defaultValue:nil];
1215 if (scenarioRestrict ==
nil)
1218 BOOL strict = [
dict oo_boolForKey:@"strict" defaultValue:NO];
1229 if (![
UNIVERSE setUseAddOns:scenarioRestrict fromSaveGame:YES])
1239 if (shipDict ==
nil)
return NO;
1240 if (![
self setUpShipFromDictionary:shipDict])
return NO;
1247 if ([dict oo_stringForKey:
@"galaxy_id"] !=
nil)
1254 [UNIVERSE setGalaxyTo:galaxy_number andReinit:YES];
1262 [UNIVERSE setSystemTo:system_id];
1270 chart_zoom = [
dict oo_floatForKey:@"chart_zoom" defaultValue:1.0];
1273 ANA_mode = [
dict oo_intForKey:@"chart_ana_mode" defaultValue:OPTIMIZED_BY_NONE];
1294 [UNIVERSE setGalaxyTo: galaxy_number andReinit:YES];
1307 NSString *keyStringValue = [
dict oo_stringForKey:@"target_coordinates"];
1309 if (keyStringValue !=
nil)
1319 if ([dict objectForKey:
@"current_system_name"])
1321 system_id = [UNIVERSE findSystemFromName:[
dict oo_stringForKey:@"current_system_name"]];
1322 if (
system_id == -1)
system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
1328 system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
1332 if ([dict objectForKey:
@"target_system_name"])
1339 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:YES];
1345 NSString *cname = [
dict oo_stringForKey:@"player_name" defaultValue:PLAYER_DEFAULT_NAME];
1356 NSMutableDictionary *equipment = [
NSMutableDictionary dictionaryWithDictionary:[
dict oo_dictionaryForKey:@"extra_equipment"]];
1359 if ([dict oo_boolForKey:
@"has_docking_computer"]) [
equipment oo_setInteger:1 forKey:@"EQ_DOCK_COMP"];
1360 if ([dict oo_boolForKey:
@"has_galactic_hyperdrive"]) [
equipment oo_setInteger:1 forKey:@"EQ_GAL_DRIVE"];
1361 if ([dict oo_boolForKey:
@"has_escape_pod"]) [
equipment oo_setInteger:1 forKey:@"EQ_ESCAPE_POD"];
1362 if ([dict oo_boolForKey:
@"has_ecm"]) [
equipment oo_setInteger:1 forKey:@"EQ_ECM"];
1363 if ([dict oo_boolForKey:
@"has_scoop"]) [
equipment oo_setInteger:1 forKey:@"EQ_FUEL_SCOOPS"];
1364 if ([dict oo_boolForKey:
@"has_energy_bomb"]) [
equipment oo_setInteger:1 forKey:@"EQ_ENERGY_BOMB"];
1365 if ([dict oo_boolForKey:
@"has_fuel_injection"]) [
equipment oo_setInteger:1 forKey:@"EQ_FUEL_INJECTION"];
1376 [
equipment oo_setInteger:1 forKey:@"EQ_NAVAL_ENERGY_UNIT"];
1380 [
equipment oo_setInteger:1 forKey:@"EQ_ENERGY_UNIT"];
1395 BOOL energyBombCompensation = NO;
1396 if ([equipment oo_boolForKey:
@"EQ_ENERGY_BOMB"] && [
OOEquipmentType equipmentTypeWithIdentifier:
@"EQ_ENERGY_BOMB"] ==
nil)
1398 energyBombCompensation = YES;
1399 [
equipment removeObjectForKey:@"EQ_ENERGY_BOMB"];
1406 [
self setFastEquipmentA:[
dict oo_stringForKey:@"primed_equipment_a" defaultValue:@"EQ_CLOAKING_DEVICE"]];
1407 [
self setFastEquipmentB:[
dict oo_stringForKey:@"primed_equipment_b" defaultValue:@"EQ_ENERGY_BOMB"]];
1409 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_COMPASS"])
compassMode = COMPASS_MODE_PLANET;
1416 voice_gender_m = [
dict oo_boolForKey:@"speech_gender" defaultValue:YES];
1417 voice_no = [UNIVERSE setVoice:[UNIVERSE voiceNumber:[
dict oo_stringForKey:@"speech_voice" defaultValue:nil]] withGenderM:voice_gender_m];
1421 [reputation release];
1422 reputation = [[
dict oo_dictionaryForKey:@"reputation"] mutableCopy];
1428 [parcel_record release];
1429 [passengers release];
1430 [passenger_record release];
1431 [contracts release];
1432 [contract_record release];
1439 contracts = [[
dict oo_arrayForKey:@"contracts"] mutableCopy];
1440 NSMutableDictionary *contractInfo =
nil;
1443 for (NSInteger i = (NSInteger)[
contracts count] - 1; i >= 0; i--)
1445 contractInfo = [[[contracts oo_dictionaryAtIndex:i] mutableCopy] autorelease];
1447 if ([[contractInfo objectForKey:
CARGO_KEY_TYPE] isKindOfClass:[NSNumber
class]])
1450 NSUInteger legacy_type = [
contractInfo oo_unsignedIntegerForKey:CARGO_KEY_TYPE];
1452 [contracts replaceObjectAtIndex:i withObject:[[
contractInfo copy] autorelease]];
1458 if (![[
UNIVERSE commodities] goodDefined:new_type])
1460 OOLog(
@"setCommanderDataFromDictionary.warning.contract",
@"Cargo contract to deliver %@ could not be loaded from the saved game, as the commodity is no longer defined",new_type);
1461 [contracts removeObjectAtIndex:i];
1467 parcels = [[
dict oo_arrayForKey:@"parcels"] mutableCopy];
1480 [specialCargo release];
1484 NSArray *legacyDestinations = [
dict oo_arrayForKey:@"missionDestinations"];
1486 NSDictionary *newDestinations = [
dict oo_dictionaryForKey:@"mission_destinations"];
1495 unsigned original_hold_size = [UNIVERSE maxCargoForShip:[
self shipDataKey]];
1500 max_cargo = [
dict oo_unsignedIntForKey:@"max_cargo" defaultValue:max_cargo];
1508 OOLogWARN(
@"setCommanderDataFromDictionary.inconsistency.max_passengers",
@"player ship %@ had max_passengers set to a value requiring more cargo space than currently available (%u). Setting max_passengers to maximum possible value (%u).", [
self name], originalMaxPassengers,
max_passengers);
1515 OOLogWARN(
@"setCommanderDataFromDictionary.inconsistency.passengers",
@"player ship %@ had more passengers (%lu) than passenger berths (%u). Removing extra passengers.", [
self name], [
passengers count],
max_passengers);
1518 [passenger_record removeObjectForKey:[[passengers oo_dictionaryAtIndex:i] oo_stringForKey:PASSENGER_KEY_NAME]];
1519 [passengers removeObjectAtIndex:i];
1525 if (excessCargo > 0)
1542 if (roundedTon || (units ==
UNITS_TONS && oldAmount > 0))
1547 while (remainingExcess > 0 && partAmount > 0)
1553 partAmount = oldAmount - toRemove;
1556 else if (!roundedTon)
1574 fuel = [
dict oo_unsignedIntForKey:@"fuel" defaultValue:fuel];
1602 if (
hud !=
nil && [
hud nonlinearScanner])
1613 ship_clock = [
dict oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START];
1619 [roleWeights release];
1627 [roleWeights addObject:@"player-unknown"];
1634 [roleWeights removeObjectsInRange:(NSRange) {
rc,[roleWeights count]-rc}];
1652 [mission_variables release];
1657 NSDictionary *planetInfoOverrides = [
dict oo_dictionaryForKey:@"scripted_planetinfo_overrides"];
1658 if (planetInfoOverrides !=
nil)
1660 [[UNIVERSE systemManager] importScriptedChanges:planetInfoOverrides];
1665 planetInfoOverrides = [
dict oo_dictionaryForKey:@"local_planetinfo_overrides"];
1666 if (planetInfoOverrides !=
nil)
1668 [[UNIVERSE systemManager] importLegacyScriptedChanges:planetInfoOverrides];
1676 NSArray *savedCommLog = [
dict oo_arrayForKey:@"comm_log"];
1678 for (NSUInteger i = 0; i < commCount; i++)
1680 [UNIVERSE addCommsMessage:[
savedCommLog objectAtIndex:i] forCount:0 andShowComms:NO logOnly:YES];
1688 entity_personality = [
dict oo_unsignedShortForKey:@"entity_personality" defaultValue:entity_personality];
1697 NSArray *missileRoles = [
dict oo_arrayForKey:@"missile_roles"];
1698 if (missileRoles !=
nil)
1703 NSString *missile_desc = [
missileRoles oo_stringAtIndex:roleIndex];
1704 if (missile_desc !=
nil && ![missile_desc isEqualToString:
@"NONE"])
1706 ShipEntity *amiss = [UNIVERSE newShipWithRole:missile_desc];
1715 OOLogWARN(
@"load.failed.missileNotFound",
@"couldn't find missile with role '%@' in [PlayerEntity setCommanderDataFromDictionary:], missile entry discarded.", missile_desc);
1723 for (NSUInteger i = 0; i <
missiles; i++)
1731 if (energyBombCompensation)
1738 if ([
self mountMissileWithRole:
@"EQ_QC_MINE"])
1740 OOLog(
@"load.upgrade.replacedEnergyBomb",
@"%@",
@"Replaced legacy energy bomb with Quirium cascade mine.");
1745 OOLog(
@"load.upgrade.replacedEnergyBomb",
@"%@",
@"Compensated legacy energy bomb with 900 credits.");
1770 whArray = [
dict objectForKey:@"wormholes"];
1771 NSEnumerator * whDicts = [
whArray objectEnumerator];
1772 NSDictionary * whCurrDict;
1773 [scannedWormholes release];
1775 while ((whCurrDict = [whDicts nextObject]) !=
nil)
1778 [scannedWormholes addObject:wh];
1795 [UNIVERSE setDockingClearanceProtocolActive:[
dict oo_boolForKey:@"docking_clearance_protocol" defaultValue:NO]];
1192- (BOOL)setCommanderDataFromDictionary:(NSDictionary *) dict {
…}
1823 NSAssert(
gOOPlayer ==
nil,
@"Expected only one PlayerEntity to exist at a time.");
1830 NSAssert(
gOOPlayer ==
self,
@"Expected only one PlayerEntity to exist at a time.");
1831 NSAssert([super initWithKey:
PLAYER_SHIP_DESC definition:[NSDictionary dictionary]] ==
self,
@"PlayerEntity requires -[ShipEntity initWithKey:definition:] to return unmodified self.");
1834#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1868- (BOOL) setUpAndConfirmOK:(BOOL)stopOnError
1868- (BOOL) setUpAndConfirmOK:(BOOL)stopOnError {
…}
1874- (BOOL) setUpAndConfirmOK:(BOOL)stopOnError saveGame:(BOOL)saveGame
1914 OOLog(
@"script.javascript.init.error",
@"%@",
@"Scheduling new JavaScript reset.");
1930 [UNIVERSE setBlockJSPlayerShipProps:NO];
1938 [UNIVERSE preloadSounds];
1941 [UNIVERSE loadConditionScripts];
1947 [UNIVERSE preloadSounds];
1952 [UNIVERSE loadConditionScripts];
1972 [UNIVERSE setAutoCommLog:YES];
1973 [UNIVERSE setPermanentCommLog:NO];
1975 [multiFunctionDisplayText release];
1978 [multiFunctionDisplaySettings release];
1981 [customDialSettings release];
1988 [mission_variables release];
1991 [localVariables release];
1996 [[UNIVERSE gameView] resetTypedString];
1999 [reputation release];
2001 [reputation oo_setInteger:0 forKey:CONTRACTS_GOOD_KEY];
2002 [reputation oo_setInteger:0 forKey:CONTRACTS_BAD_KEY];
2003 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:CONTRACTS_UNKNOWN_KEY];
2004 [reputation oo_setInteger:0 forKey:PASSAGE_GOOD_KEY];
2005 [reputation oo_setInteger:0 forKey:PASSAGE_BAD_KEY];
2006 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PASSAGE_UNKNOWN_KEY];
2007 [reputation oo_setInteger:0 forKey:PARCEL_GOOD_KEY];
2008 [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
2009 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
2013 for (i = 0 ; i < 8 ; i++)
2015 [roleWeights addObject:@"player-unknown"];
2045 [passengers release];
2047 [passenger_record release];
2050 [contracts release];
2052 [contract_record release];
2057 [parcel_record release];
2060 [missionDestinations release];
2063 [shipyard_record release];
2066 [target_memory release];
2092 voice_gender_m = YES;
2093 voice_no = [UNIVERSE setVoice:-1 withGenderM:voice_gender_m];
2096 [_customViews release];
2134 shipCommodityData = [[[UNIVERSE commodities] generateManifestForPlayer] retain];
2140 [eqScripts release];
2186 [UNIVERSE clearGUIs];
2196 [specialCargo release];
2209 [save_path autorelease];
2212 [scannedWormholes release];
2221 [dockingReport release];
2225 shipAI = [[
AI alloc] initWithStateMachine:PLAYER_DOCKING_AI_NAME andState:@"GLOBAL"];
2233 [UNIVERSE setGalaxyTo:galaxy_number];
2234 [UNIVERSE setSystemTo:system_id];
1874- (BOOL) setUpAndConfirmOK:(BOOL)stopOnError saveGame:(BOOL)saveGame {
…}
2258- (void) completeSetUpAndSetTarget:(BOOL)setTarget
2258- (void) completeSetUpAndSetTarget:(BOOL)setTarget {
…}
2280- (BOOL) setUpShipFromDictionary:(NSDictionary *)shipDict
2283 [UNIVERSE setBlockJSPlayerShipProps:NO];
2285 if (![super setUpFromDictionary:shipDict])
return NO;
2353 NSArray *customViews = [
shipDict oo_arrayForKey:@"custom_views"];
2354 if (customViews !=
nil)
2356 [_customViews release];
2365 NSDictionary *scriptProperties = [
NSDictionary dictionaryWithObject:
self forKey:@"ship"];
2280- (BOOL) setUpShipFromDictionary:(NSDictionary *)shipDict {
…}
2467 return [UNIVERSE sessionID];
2481 case STATUS_START_GAME:
2482 case STATUS_DOCKING:
2485 case STATUS_ESCAPE_SEQUENCE:
2494- (NSComparisonResult) compareZeroDistance:(
Entity *)otherEntity
2496 return NSOrderedDescending;
2494- (NSComparisonResult) compareZeroDistance:(
Entity *)otherEntity {
…}
2506- (GLfloat) lookingAtSunWithThresholdAngleCos:(GLfloat) thresholdAngleCos
2509 GLfloat measuredCos = 999.0f, measuredCosAbs;
2510 GLfloat sunBrightness = 0.0f;
2516 OOViewID vdir = [UNIVERSE viewDirection];
2518 unsigned ent_count =
UNIVERSE->n_entities;
2520 for (i = 0; i < ent_count; i++)
2525 ([uni_entities[i]
isShip] &&
2529 if (
EXPECT(vdir > VIEW_STARBOARD || ![uni_entities[i]
isPlayer]))
2531 float shadow = 1.5f;
2548 measuredCos = -dot_product(unitRelativePosition,
v_forward);
2551 measuredCos = +dot_product(unitRelativePosition,
v_forward);
2554 measuredCos = +dot_product(unitRelativePosition,
v_right);
2556 case VIEW_STARBOARD:
2557 measuredCos = -dot_product(unitRelativePosition,
v_right);
2563 measuredCos = -dot_product(unitRelativePosition, absoluteView);
2570 measuredCosAbs = fabs(measuredCos);
2577 if (thresholdAngleCos <= measuredCosAbs && measuredCosAbs <= 1.1f)
2579 sunBrightness = (measuredCos - thresholdAngleCos) / (1.0f - thresholdAngleCos);
2581 if (sunBrightness < 0.0f) sunBrightness = 0.0f;
2582 else if (sunBrightness > 1.0f) sunBrightness = 1.0f;
2585 return sunBrightness * sunBrightness * sunBrightness;
2506- (GLfloat) lookingAtSunWithThresholdAngleCos:(GLfloat) thresholdAngleCos {
…}
2591 GLfloat insideAtmoFrac = 0.0f;
2593 if ([
UNIVERSE airResistanceFactor] > 0.01)
2598 return insideAtmoFrac;
2603#define STAGE_TRACKING_BEGIN { \
2604 NSString * volatile updateStage = @"initialisation"; \
2603#define STAGE_TRACKING_BEGIN { \ …
2606#define STAGE_TRACKING_END } \
2607 @catch (NSException *exception) \
2609 OOLog(kOOLogException, @"***** Exception during [%@] in %s : %@ : %@ *****", updateStage, __PRETTY_FUNCTION__, [exception name], [exception reason]); \
2606#define STAGE_TRACKING_END } \ …
2613#define UPDATE_STAGE(x) do { updateStage = (x); } while (0)
2615#define STAGE_TRACKING_BEGIN {
2616#define STAGE_TRACKING_END }
2617#define UPDATE_STAGE(x) do { (void) (x); } while (0);
2664 gui_screen != GUI_SCREEN_KEYBOARD_CONFIRMCLEAR &&
2674 if (
status == STATUS_AUTOPILOT_ENGAGED ||
status == STATUS_ESCAPE_SEQUENCE)
2688 if (
status == STATUS_IN_FLIGHT)
2693 if (
status == STATUS_WITCHSPACE_COUNTDOWN)
2698 if (
status == STATUS_EXITING_WITCHSPACE)
2703 if (
status == STATUS_LAUNCHING)
2708 if (
status == STATUS_DOCKING)
2713 if (
status == STATUS_DEAD)
2726- (void) doBookkeeping:(
double) delta_t
2732 static BOOL gettingInterference = NO;
2735 double external_temp = 0;
2736 GLfloat air_friction = 0.0f;
2737 air_friction = 0.5f * [UNIVERSE airResistanceFactor];
2738 if (air_friction < 0.005f)
2744 UPDATE_STAGE(
@"updating weapon temperatures and shot times");
2820 [UNIVERSE addMessage:DESC(@"ecm-out-of-juice") forCount:3.0];
2835 if (!gettingInterference)
2837 [UNIVERSE setCurrentPostFX:OO_POSTFX_CRTBADSIGNAL];
2838 gettingInterference = YES;
2843 if (gettingInterference)
2845 [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
2846 gettingInterference = NO;
2877 float rechargeAft =
MIN(shieldRechargeAft, aftMax -
aft_shield);
2883 float energyForShields =
energy;
2887 float minEnergyBankLevel = [[UNIVERSE globalSettings] oo_floatForKey:@"shield_charge_energybank_threshold" defaultValue:0.25];
2893 rechargeFwd =
MIN(rechargeFwd, energyForShields);
2894 rechargeAft =
MIN(rechargeAft, energyForShields - rechargeFwd);
2898 rechargeAft =
MIN(rechargeAft, energyForShields);
2899 rechargeFwd =
MIN(rechargeFwd, energyForShields - rechargeAft);
2905 energy -= rechargeFwd + rechargeAft;
2918 double alt1 = sun_cr * sun_cr / sun_zd;
2922 external_temp *= 100;
2924 if ([sun willGoNova])
2939 [UNIVERSE displayCountdownMessage:DESC(@"fuel-scoop-active") forCount:1.0];
2945 if ((
status != STATUS_ESCAPE_SEQUENCE) && (
status != STATUS_ENTERING_WITCHSPACE))
2986 [UNIVERSE setSystemTo:system_id];
2989 [UNIVERSE setUpSpace];
2991 [UNIVERSE populateNormalSpace];
2996 [UNIVERSE setWitchspaceBreakPattern:YES];
3000 [[UNIVERSE planet] update: 2.34375 * market_rnd];
3001 [[UNIVERSE station] update: 2.34375 * market_rnd];
3004 Entity *dockTargetEntity = [UNIVERSE entityForUniversalID:_dockTarget];
3016 [UNIVERSE setViewDirection:VIEW_FORWARD];
3017 [UNIVERSE setBlockJSPlayerShipProps:NO];
3018 [
self enterDock:(StationEntity *)dockTargetEntity];
3025 [UNIVERSE displayMessage:DESC(@"gameoverscreen-escape-pod") forCount:kDeadResetTime];
3026 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
3052 [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:4.5];
3067 flightSpeed -= (float)(speed_delta * delta_t * abFactor);
3072 flightSpeed += (float)(speed_delta * delta_t * abFactor);
3132 if (floor(z1) > floor(z))
3149 [[UNIVERSE gameView] setFov:fieldOfView fromFraction:YES];
3155 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
3191 if (mouseWheelDelta > 0.0f)
3196 else if (mouseWheelDelta < 0.0f)
2726- (void) doBookkeeping:(
double) delta_t {
…}
3208 hasMoved = !HPvector_equal(position, lastPosition);
3209 hasRotated = !quaternion_equal(orientation, lastOrientation);
3210 lastPosition = position;
3211 lastOrientation = orientation;
3217 if (![
self isInSpace] || [
self status] == STATUS_DOCKING)
3224 int i, ent_count =
UNIVERSE->n_entities;
3228 for (i = 0; i < ent_count; i++)
3232 BOOL massLocked = NO;
3233 BOOL foundHostiles = NO;
3234#if OO_VARIABLE_TORUS_SPEED
3235 BOOL needHyperspeedNearest = YES;
3236 double hsnDistance = 0;
3238 for (i = 0; i < ent_count; i++)
3240 scannedEntity = my_entities[
i];
3242#if OO_VARIABLE_TORUS_SPEED
3246 if (scannedEntity !=
self && [scannedEntity canCollide] && (![scannedEntity isShip] || ![
self collisionExceptedFor:(
ShipEntity *) scannedEntity]))
3249 needHyperspeedNearest = NO;
3252 else if ([scannedEntity isStellarObject])
3258 if (thisHSN < hsnDistance)
3260 hsnDistance = thisHSN;
3271 if ([
self massLockable] )
3275 if (theirClass != CLASS_NO_DRAW)
3277 if (theirClass == CLASS_THARGOID || [scannedEntity isCascadeWeapon])
3279 foundHostiles = YES;
3281 else if ([scannedEntity isShip])
3289#if OO_VARIABLE_TORUS_SPEED
3322 for (i = 0; i < ent_count; i++)
3327 BOOL energyCritical = NO;
3328 if (energy < 64 && energy < maxEnergy * 0.8)
3330 energyCritical = YES;
3341- (void) setMaxFlightPitch:(GLfloat)new
3341- (void) setMaxFlightPitch:(GLfloat)new {
…}
3348- (void) setMaxFlightRoll:(GLfloat)new
3348- (void) setMaxFlightRoll:(GLfloat)new {
…}
3355- (void) setMaxFlightYaw:(GLfloat)new
3355- (void) setMaxFlightYaw:(GLfloat)new {
…}
3362- (BOOL) checkEntityForMassLock:(
Entity *)ent withScanClass:(
int)theirClass
3364 BOOL massLocked = NO;
3377 if (dist < rad*rad*factor || dist < rad*rad + 50000*rad + 625000000 )
3383 else if (theirClass != CLASS_NO_DRAW)
3387 theirClass = CLASS_NO_DRAW;
3397 if (entIsCloakedShip && ![ent isPlayer])
3407 case CLASS_VISUAL_EFFECT:
3410 case CLASS_THARGOID:
3414 case CLASS_MILITARY:
3415 case CLASS_WORMHOLE:
3362- (BOOL) checkEntityForMassLock:(
Entity *)ent withScanClass:(
int)theirClass {
…}
3435 if (cond != lastScriptAlertCondition)
3437 ShipScriptEventNoCx(
self,
"alertConditionChanged", INT_TO_JSVAL(cond), INT_TO_JSVAL(lastScriptAlertCondition));
3438 lastScriptAlertCondition = cond;
3465 else if ((fleeing_status ==
PLAYER_FLEEING_MAYBE || fleeing_status ==
PLAYER_FLEEING_CARGO) && cond ==
ALERT_CONDITION_RED && last_shot_time + 10 < t && flightSpeed > 0.75*maxFlightSpeed && energy < maxEnergy * 0.5 && (forward_shield < [
self maxForwardShieldLevel]*0.25 || aft_shield < [
self maxAftShieldLevel]*0.25))
3477 if (![
self scoopOverride])
3489 shot_time += delta_t;
3490 script_time += delta_t;
3491 unsigned prev_day = floor(ship_clock / 86400);
3492 ship_clock += delta_t;
3493 if (ship_clock_adjust > 0.0)
3495 double fine_adjust = delta_t * 7200.0;
3496 if (ship_clock_adjust > 86400)
3497 fine_adjust = delta_t * 115200.0;
3498 if (ship_clock_adjust > 0)
3500 if (fine_adjust > ship_clock_adjust)
3501 fine_adjust = ship_clock_adjust;
3502 ship_clock += fine_adjust;
3503 ship_clock_adjust -= fine_adjust;
3507 if (fine_adjust < ship_clock_adjust)
3508 fine_adjust = ship_clock_adjust;
3509 ship_clock -= fine_adjust;
3510 ship_clock_adjust += fine_adjust;
3514 ship_clock_adjust = 0.0;
3516 unsigned now_day = floor(ship_clock / 86400.0);
3517 while (prev_day < now_day)
3526 if (ship_clock > fps_check_time)
3528 if (![
self clockAdjusting])
3530 fps_counter = (
int)([
UNIVERSE timeAccelerationFactor] * floor([
UNIVERSE framesDoneThisUpdate] / (fps_check_time - last_fps_check_time)));
3531 last_fps_check_time = fps_check_time;
3538 fps_counter = (
int)([
UNIVERSE timeAccelerationFactor] * floor(1.0 / delta_t));
3541 [UNIVERSE resetFramesDoneThisUpdate];
3548 if (script_time <= script_time_check)
return;
3550 if ([
self status] != STATUS_IN_FLIGHT)
3555 case GUI_SCREEN_MAIN:
3556 case GUI_SCREEN_INTRO1:
3557 case GUI_SCREEN_SHIPLIBRARY:
3558 case GUI_SCREEN_KEYBOARD:
3559 case GUI_SCREEN_NEWGAME:
3560 case GUI_SCREEN_OXZMANAGER:
3561 case GUI_SCREEN_MARKET:
3562 case GUI_SCREEN_MARKETINFO:
3563 case GUI_SCREEN_OPTIONS:
3564 case GUI_SCREEN_GAMEOPTIONS:
3565 case GUI_SCREEN_LOAD:
3566 case GUI_SCREEN_SAVE:
3567 case GUI_SCREEN_SAVE_OVERWRITE:
3568 case GUI_SCREEN_STICKMAPPER:
3569 case GUI_SCREEN_STICKPROFILE:
3570 case GUI_SCREEN_MISSION:
3571 case GUI_SCREEN_REPORT:
3572 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
3573 case GUI_SCREEN_KEYBOARD_CONFIG:
3574 case GUI_SCREEN_KEYBOARD_ENTRY:
3575 case GUI_SCREEN_KEYBOARD_LAYOUT:
3580 case GUI_SCREEN_EQUIP_SHIP:
3581 case GUI_SCREEN_INTERFACES:
3582 case GUI_SCREEN_MANIFEST:
3583 case GUI_SCREEN_SHIPYARD:
3584 case GUI_SCREEN_LONG_RANGE_CHART:
3585 case GUI_SCREEN_SHORT_RANGE_CHART:
3586 case GUI_SCREEN_STATUS:
3587 case GUI_SCREEN_SYSTEM_DATA:
3595 script_time_check += script_time_interval;
3604 for (i = [
self trumbleCount] ; i > 0; i--)
3621 if (stationForDocking ==
nil)
return;
3630 if (stationDockingClearanceStatus !=
nil)
3633 if ([stationDockingClearanceStatus isEqualToString:
@"DOCKING_CLEARANCE_GRANTED"])
3635 [
self doScriptEvent:OOJSID("playerDockingClearanceGranted")];
3650 if (stationForDocking ==
nil)
return;
3661 if (stationDockingClearanceStatus !=
nil && [stationDockingClearanceStatus isEqualToString:
@"DOCKING_CLEARANCE_CANCELLED"])
3663 [
self doScriptEvent:OOJSID("playerDockingClearanceCancelled")];
3670 if (stationForDocking ==
nil)
return NO;
3685 [
self setStatus:STATUS_AUTOPILOT_ENGAGED];
3730 [
self setAITo:PLAYER_DOCKING_AI_NAME ];
3739#define VELOCITY_CLEANUP_MIN 2000.0f
3740#define VELOCITY_CLEANUP_FULL 5000.0f
3741#define VELOCITY_CLEANUP_RATE 0.001f
3744#if OO_VARIABLE_TORUS_SPEED
3775 GLfloat thrust_factor = 1.0;
3776 if (flightSpeed > maxFlightSpeed)
3778 if (afterburner_engaged)
3789 GLfloat velmag = magnitude(velocity);
3790 GLfloat velmag2 = velmag - (float)delta_t * thrust * thrust_factor;
3801 velmag2 -= velmag * rate;
3804 else velocity = vector_multiply_scalar(velocity, velmag2 / velmag);
3810 if (flightYaw != 0.0)
3812 [
self applyYaw:(float)delta_t*flightYaw];
3833 witchspaceCountdown = fdim(witchspaceCountdown, delta_t);
3839 if (
EXPECT_NOT(galactic_witchjump && ![
self hasEquipmentItem:
@"EQ_GAL_DRIVE"]))
3841 galactic_witchjump = NO;
3848 int seconds = round(witchspaceCountdown);
3849 if (galactic_witchjump)
3851 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-galactic-in-x-seconds", seconds) forCount:1.0];
3856 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
3859 if (witchspaceCountdown == 0.0)
3862 if (!galactic_witchjump)
3872 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
3882 galactic_witchjump = NO;
3902 [UNIVERSE addMessage:[
NSString stringWithFormat:@" %@. ",[UNIVERSE getSystemName:system_id]] forCount:3.0];
3904 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_COMPASS"])
3905 compassMode = COMPASS_MODE_PLANET;
3907 compassMode = COMPASS_MODE_BASIC;
3911 if ([
UNIVERSE inInterstellarSpace]) [UNIVERSE addMessage:DESC(@"witch-engine-malfunction") forCount:3.0];
3927 suppressAegisMessages=NO;
3936 flightRoll = launchRoll;
3949 StationEntity *stationLaunchedFrom = [UNIVERSE nearestEntityMatchingPredicate:IsStationPredicate parameter:NULL relativeToEntity:
self];
3963 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3964 if ([
UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3970 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3971 if ([
UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3977 BOOL was_mouse_control_on = mouse_control_on;
3978 [UNIVERSE handleGameOver];
3979 mouse_control_on = was_mouse_control_on;
3986 float secondsToBWFadeOut = [[
NSUserDefaults standardUserDefaults] oo_floatForKey:@"gameover-seconds-to-bw-fadeout" defaultValue:5.0f];
3990 static float originalColorSaturation = -1.0f;
3992 if ([
self shotTime] < secondsToBWFadeOut)
3996 if (fps_counter != 0)
3998 [
gameView adjustColorSaturation:-(originalColorSaturation * (1.0f / secondsToBWFadeOut) * [UNIVERSE timeAccelerationFactor] / fps_counter)];
4008 originalColorSaturation = -1.0f;
4037 if (tstatus == STATUS_ENTERING_WITCHSPACE || tstatus == STATUS_IN_HOLD || tstatus == STATUS_DOCKED)
4046 [
self hasEquipmentItemProviding:
@"EQ_WORMHOLE_SCANNER"] &&
ident_engaged)
4059 NSString *scoreMS = [
NSString stringWithFormat:OOExpandKey(@"gameoverscreen-score-@"),
4060 KillCountToRatingAndKillString(ship_kills)];
4062 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-game-over") forCount:kDeadResetTime];
4063 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4064 [UNIVERSE displayMessage:scoreMS forCount:kDeadResetTime];
4065 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4066 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-press-space") forCount:kDeadResetTime];
4067 [UNIVERSE displayMessage:@" " forCount:kDeadResetTime];
4068 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4073- (void) showShipModelWithKey:(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context
4075 if (shipKey ==
nil)
return;
4077 if (shipData ==
nil)
return;
4079 Quaternion q2 = { (GLfloat)
M_SQRT1_2, (GLfloat)
M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
4092 if (context)
OOLog(
@"script.debug.note.showShipModel",
@"::::: showShipModel:'%@' in context: %@.", [ship
name], context);
4102 id subEntStatus = [
shipData objectForKey:@"subentities_status"];
4105 [UNIVERSE addEntity: ship];
4073- (void) showShipModelWithKey:(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context {
…}
4122 case GUI_SCREEN_GAMEOPTIONS:
4126 case GUI_SCREEN_STATUS:
4152 if (ident_engaged && [
self primaryTarget] !=
nil)
4154 if (![
self isValidTarget:[
self primaryTarget]])
4156 if (!suppressTargetLost)
4158 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4164 suppressTargetLost = NO;
4176 for (i = 0; i < max_missiles; i++)
4178 if ([missile_entity[i] primaryTarget] !=
nil &&
4179 ![
self isValidTarget:[missile_entity[i] primaryTarget]])
4181 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4184 if (i == activeMissile)
4190 }
else if (i == activeMissile && [missile_entity[i] primaryTarget] ==
nil) {
4199 if ([
self primaryTarget] ==
nil &&
4201 ([
self status] == STATUS_IN_FLIGHT || [
self status] == STATUS_WITCHSPACE_COUNTDOWN))
4203 Entity *target = [UNIVERSE firstEntityTargetedByPlayer];
4204 if ([
self isValidTarget:target])
4212 UPDATE_STAGE(
@"checking for additional wormhole information");
4213 if ([[
self primaryTarget] isWormhole])
4216 switch ([wh scanInfo])
4230 if ([
self clockTimeAdjusted] > [wh scanTime] + 2)
4238 if([
self clockTimeAdjusted] > [wh scanTime] + 4)
4241 [UNIVERSE addCommsMessage:[
NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
4246 if ([
self clockTimeAdjusted] > [wh scanTime] + 7)
4249 [UNIVERSE addCommsMessage:[
NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
4254 if ([
self clockTimeAdjusted] > [wh scanTime] + 10)
4281- (void) applyAttitudeChanges:(
double) delta_t
4281- (void) applyAttitudeChanges:(
double) delta_t {
…}
4288- (void) applyRoll:(GLfloat) roll1 andClimb:(GLfloat) climb1
4290 if (roll1 == 0.0 && climb1 == 0.0 &&
hasRotated == NO)
4288- (void) applyRoll:(GLfloat) roll1 andClimb:(GLfloat) climb1 {
…}
4321- (void) applyYaw:(GLfloat) yaw
4321- (void) applyYaw:(GLfloat) yaw {
…}
4339 return OOMatrixTranslate(result, HPVectorToVector(
position));
4349- (void) setNormalOrientation:(Quaternion) quat
4351 [
self setOrientation:make_quaternion(-quat.w, quat.x, quat.y, quat.z)];
4349- (void) setNormalOrientation:(Quaternion) quat {
…}
4355- (void) moveForward:(
double) amount
4358 [
self setPosition:HPvector_add(position, vectorToHPVector(vector_multiply_scalar(v_forward, (float)amount)))];
4355- (void) moveForward:(
double) amount {
…}
4382 case VIEW_STARBOARD:
4432 viewpoint.x +=
offset.x * r.m[0][0]; viewpoint.y +=
offset.x * r.m[1][0]; viewpoint.z +=
offset.x * r.m[2][0];
4433 viewpoint.x +=
offset.y * r.m[0][1]; viewpoint.y +=
offset.y * r.m[1][1]; viewpoint.z +=
offset.y * r.m[2][1];
4434 viewpoint.x +=
offset.z * r.m[0][2]; viewpoint.y +=
offset.z * r.m[1][2]; viewpoint.z +=
offset.z * r.m[2][2];
4440- (void) drawImmediate:(
bool)immediate translucent:(
bool)translucent
4445 case STATUS_COCKPIT_DISPLAY:
4447 case STATUS_START_GAME:
4451 if ([
UNIVERSE breakPatternHide])
return;
4440- (void) drawImmediate:(
bool)immediate translucent:(
bool)translucent {
…}
4458- (void) setMassLockable:(BOOL)newValue
4458- (void) setMassLockable:(BOOL)newValue {
…}
4489- (void) setOcclusionLevel:(
float)level
4489- (void) setOcclusionLevel:(
float)level {
…}
4537 NSString *hud_desc = [
shipDict oo_stringForKey:@"hud" defaultValue:@"hud.plist"];
4538 if (![
self switchHudTo:hud_desc]) [
self switchHudTo:@"hud.plist"];
4542- (BOOL) switchHudTo:(NSString *)hudFileName
4544 NSDictionary *hudDict =
nil;
4545 BOOL wasHidden = NO;
4546 BOOL wasCompassActive = YES;
4547 double scannerZoom = 1.0;
4548 NSUInteger lastMFD = 0;
4551 if (!hudFileName)
return NO;
4564 OOLog(
@"PlayerEntity.switchHudTo.failed",
@"HUD dictionary file %@ to switch to not found or invalid.", hudFileName);
4582 hud = [[
HeadUpDisplay alloc] initWithDictionary:hudDict inFile:hudFileName];
4589 NSArray *savedMFDs = [
NSArray arrayWithArray:multiFunctionDisplaySettings];
4590 [multiFunctionDisplaySettings removeAllObjects];
4593 if ([savedMFDs
count] > i)
4595 [multiFunctionDisplaySettings addObject:[
savedMFDs objectAtIndex:i]];
4599 [multiFunctionDisplaySettings addObject:[
NSNull null]];
4542- (BOOL) switchHudTo:(NSString *)hudFileName {
…}
4609- (float) dialCustomFloat:(NSString *)dialKey
4611 return [customDialSettings oo_floatForKey:dialKey defaultValue:0.0];
4609- (float) dialCustomFloat:(NSString *)dialKey {
…}
4615- (NSString *) dialCustomString:(NSString *)dialKey
4617 return [customDialSettings oo_stringForKey:dialKey defaultValue:@""];
4615- (NSString *) dialCustomString:(NSString *)dialKey {
…}
4627- (void) setDialCustom:(
id)value forKey:(NSString *)dialKey
4629 [customDialSettings setObject:value forKey:dialKey];
4627- (void) setDialCustom:(
id)value forKey:(NSString *)dialKey {
…}
4633- (void) setShowDemoShips:(BOOL)value
4633- (void) setShowDemoShips:(BOOL)value {
…}
4669- (void) setMaxForwardShieldLevel:(
float)new
4669- (void) setMaxForwardShieldLevel:(
float)new {
…}
4675- (void) setMaxAftShieldLevel:(
float)new
4675- (void) setMaxAftShieldLevel:(
float)new {
…}
4681- (void) setForwardShieldRechargeRate:(
float)new
4681- (void) setForwardShieldRechargeRate:(
float)new {
…}
4687- (void) setAftShieldRechargeRate:(
float)new
4687- (void) setAftShieldRechargeRate:(
float)new {
…}
4705- (void) setForwardShieldLevel:(GLfloat)level
4705- (void) setForwardShieldLevel:(GLfloat)level {
…}
4711- (void) setAftShieldLevel:(GLfloat)level
4711- (void) setAftShieldLevel:(GLfloat)level {
…}
4733 if ((result < 1.0f)&&(result > -1.0f))
4744 if ((result < 1.0f)&&(result > -1.0f))
4755 if ((result < 1.0f)&&(result > -1.0f))
4766 return OOClamp_0_1_f(result);
4783 return OOClamp_0_1_f(result);
4794 return OOClamp_0_1_f(result);
4801 return OOClamp_0_1_f(result);
4831 return OOClamp_0_1_f(result);
4838 return OOClamp_0_1_f(result);
4846 return OOClamp_0_1_f(result);
4853 return OOClamp_0_1_f(result);
4860 return OOClamp_0_1_f(result);
4874 if (nearestPlanet ==
nil)
return 1.0f;
4878 GLfloat alt = sqrt(zd) - cr;
4902- (void) addToAdjustTime:(
double)seconds
4902- (void) addToAdjustTime:(
double)seconds {
…}
4914- (void) setEscapePodRescueTime:(
double)seconds
4914- (void) setEscapePodRescueTime:(
double)seconds {
…}
4934 return [
NSString stringWithFormat:@"FPS: %3d", fpsVal];
4940 NSString *result = [
NSString stringWithFormat:@"Entities: %3ld", [UNIVERSE entityCount]];
4942 result = [
NSString stringWithFormat:@"%@ (%d, %zu KiB, avg %lu bytes)", result, gLiveEntityCount, gTotalEntityMemory >> 10, gTotalEntityMemory / gLiveEntityCount];
4951 unsigned n_missiles = 0;
4973 OOLogERR(
@"player.missilesUnsafe",
@"%@",
@"Missile state is not SAFE when weapons are offline. This is a bug, please report it.");
5013- (void) setFuelLeakRate:(
float)value
5013- (void) setFuelLeakRate:(
float)value {
…}
5025 NSUInteger
count = [commLog count];
5028 [commLog removeObjectsInRange:NSMakeRange(0, count - kCommLogTrimSize)];
5052 NSString *role =
nil;
5053 if ([[victim
primaryRole] isEqualToString:
@"escape-capsule"])
5055 role =
@"assassin-player";
5057 else if ([victim
bounty] > 0)
5067 role =
@"pirate-interceptor";
5073 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5075 [roleWeightFlags setObject:[
NSNumber numberWithUnsignedInteger:times] forKey:role];
5076 if ((times & (times-1)) == 0)
5085 NSString *role =
@"miner";
5086 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5088 [roleWeightFlags setObject:[
NSNumber numberWithUnsignedInteger:times] forKey:role];
5089 if ((times & (times-1)) == 0)
5096- (void) addRoleToPlayer:(NSString *)role
5096- (void) addRoleToPlayer:(NSString *)role {
…}
5103- (void) addRoleToPlayer:(NSString *)role inSlot:(NSUInteger)slot
5111 [roleWeights addObject:role];
5115 [roleWeights replaceObjectAtIndex:slot withObject:role];
5103- (void) addRoleToPlayer:(NSString *)role inSlot:(NSUInteger)slot {
…}
5120- (void) clearRoleFromPlayer:(BOOL)includingLongRange
5122 NSUInteger slot =
Ranrot() % [roleWeights count];
5123 if (!includingLongRange)
5125 NSString *role = [roleWeights objectAtIndex:slot];
5127 if ([role hasSuffix:
@"+"] &&
randf() > 0.5)
5132 [roleWeights replaceObjectAtIndex:slot withObject:@"player-unknown"];
5120- (void) clearRoleFromPlayer:(BOOL)includingLongRange {
…}
5136- (void) clearRolesFromPlayer:(
float)chance
5138 NSUInteger i,
count=[roleWeights count];
5139 for (i = 0; i <
count; i++)
5141 if (
randf() < chance)
5143 [roleWeights replaceObjectAtIndex:i withObject:@"player-unknown"];
5136- (void) clearRolesFromPlayer:(
float)chance {
…}
5173 NSUInteger memory = 4;
5188 [roleSystemList removeObjectAtIndex:0];
5190 [roleSystemList addObject:[
NSNumber numberWithInt:sys]];
5216 OOPlanetEntity *the_planet = [UNIVERSE planet];
5219 Entity <OOBeaconEntity> *beacon = [
self nextBeacon];
5220 if ([
self isInSpace] && the_sun && the_planet
5221 && ![the_sun goneNova])
5228 case COMPASS_MODE_INACTIVE:
5231 case COMPASS_MODE_BASIC:
5234 new_target = the_station;
5238 new_target = the_planet;
5242 case COMPASS_MODE_PLANET:
5243 new_target = the_planet;
5246 case COMPASS_MODE_STATION:
5247 new_target = the_station;
5250 case COMPASS_MODE_SUN:
5251 new_target = the_sun;
5254 case COMPASS_MODE_TARGET:
5255 new_target = the_target;
5258 case COMPASS_MODE_BEACONS:
5259 new_target = beacon;
5263 if (new_target ==
nil || [new_target
status] < STATUS_ACTIVE || [new_target
status] == STATUS_IN_HOLD)
5266 new_target = the_planet;
5282 case COMPASS_MODE_INACTIVE:
5284 case COMPASS_MODE_BASIC:
5286 case COMPASS_MODE_BEACONS:
5295 case COMPASS_MODE_PLANET:
5296 return [[UNIVERSE planet] name];
5297 case COMPASS_MODE_SUN:
5298 return [[UNIVERSE sun] name];
5299 case COMPASS_MODE_STATION:
5300 return [[UNIVERSE station] displayName];
5301 case COMPASS_MODE_TARGET:
5302 return DESC(
@"oolite-beacon-label-target");
5323 Entity <OOBeaconEntity> *beacon =
nil;
5327 case COMPASS_MODE_INACTIVE:
5328 case COMPASS_MODE_BASIC:
5329 case COMPASS_MODE_PLANET:
5330 beacon = [UNIVERSE lastBeacon];
5333 beacon = [
beacon prevBeacon];
5344 case COMPASS_MODE_BEACONS:
5348 beacon = [
beacon prevBeacon];
5366 case COMPASS_MODE_TARGET:
5370 case COMPASS_MODE_SUN:
5382 case COMPASS_MODE_STATION:
5392 Entity <OOBeaconEntity> *beacon =
nil;
5396 case COMPASS_MODE_INACTIVE:
5397 case COMPASS_MODE_BASIC:
5398 case COMPASS_MODE_PLANET:
5410 case COMPASS_MODE_STATION:
5414 case COMPASS_MODE_SUN:
5422 case COMPASS_MODE_TARGET:
5423 beacon = [UNIVERSE firstBeacon];
5426 beacon = [
beacon nextBeacon];
5434 case COMPASS_MODE_BEACONS:
5438 beacon = [
beacon nextBeacon];
5457- (void) setActiveMissile:(NSUInteger)value
5457- (void) setActiveMissile:(NSUInteger)value {
…}
5475- (void) setDialIdentEngaged:(BOOL)newValue
5475- (void) setDialIdentEngaged:(BOOL)newValue {
…}
5490 NSString *result =
nil;
5492 if (target_entity ==
nil)
5494 result =
DESC(
@"no-target-string");
5497 if ([target_entity respondsToSelector:
@selector(identFromShip:)])
5502 if (result ==
nil) result =
DESC(
@"unknown-target");
5514- (NSString *) multiFunctionText:(NSUInteger)i
5516 NSString *key = [multiFunctionDisplaySettings oo_stringAtIndex:i defaultValue:nil];
5521 NSString *text = [multiFunctionDisplayText oo_stringForKey:key defaultValue:nil];
5514- (NSString *) multiFunctionText:(NSUInteger)i {
…}
5526- (void) setMultiFunctionText:(NSString *)text forKey:(NSString *)key
5530 [multiFunctionDisplayText setObject:text forKey:key];
5532 else if (key !=
nil)
5534 [multiFunctionDisplayText removeObjectForKey:key];
5539 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[
NSNull null]];
5526- (void) setMultiFunctionText:(NSString *)text forKey:(NSString *)key {
…}
5545- (BOOL) setMultiFunctionDisplay:(NSUInteger)index toKey:(NSString *)key
5547 if (index >= [
hud mfdCount])
5550 index = [multiFunctionDisplaySettings indexOfObject:[
NSNull null]];
5551 if (index == NSNotFound)
5557 if (index < [
hud mfdCount])
5561 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[
NSNull null]];
5565 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:key];
5545- (BOOL) setMultiFunctionDisplay:(NSUInteger)index toKey:(NSString *)key {
…}
5576- (void) cycleNextMultiFunctionDisplay:(NSUInteger) index
5578 if ([[
self hud] mfdCount] == 0)
return;
5579 NSArray *keys = [multiFunctionDisplayText allKeys];
5580 NSString *key =
nil;
5581 if ([keys
count] == 0)
5586 id current = [multiFunctionDisplaySettings objectAtIndex:index];
5587 if (current == [NSNull
null])
5589 key = [
keys objectAtIndex:0];
5594 NSUInteger cIndex = [
keys indexOfObject:current];
5595 if (cIndex == NSNotFound || cIndex + 1 >= [keys
count])
5602 key = [
keys objectAtIndex:(cIndex+1)];
5576- (void) cycleNextMultiFunctionDisplay:(NSUInteger) index {
…}
5613- (void) cyclePreviousMultiFunctionDisplay:(NSUInteger) index
5615 if ([[
self hud] mfdCount] == 0)
return;
5616 NSArray *keys = [multiFunctionDisplayText allKeys];
5617 NSString *key =
nil;
5618 if ([keys
count] == 0)
5623 id current = [multiFunctionDisplaySettings objectAtIndex:index];
5624 if (current == [NSNull
null])
5626 key = [
keys objectAtIndex:([
keys count]-1)];
5631 NSUInteger cIndex = [
keys indexOfObject:current];
5632 if (cIndex == NSNotFound || cIndex == 0)
5639 key = [
keys objectAtIndex:(cIndex-1)];
5613- (void) cyclePreviousMultiFunctionDisplay:(NSUInteger) index {
…}
5652 if ([[
self hud] mfdCount] == 0)
return;
5655 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5664 if ([[
self hud] mfdCount] == 0)
return;
5674 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5761 if( [
self hasEquipmentItemProviding:
@"EQ_MULTI_TARGET"] &&
5774 if([
self hasEquipmentItemProviding:
@"EQ_MULTI_TARGET"] && !
launchingMissile)
5805- (void) setAlertFlag:(
int)flag to:(BOOL)value
5805- (void) setAlertFlag:(
int)flag to:(BOOL)value {
…}
5865- (void) interpretAIMessage:(NSString *)ms
5867 if ([ms isEqual:
@"HOLD_FULL"])
5870 [UNIVERSE addMessage:DESC(@"hold-full") forCount:4.5];
5873 if ([ms isEqual:
@"INCOMING_MISSILE"])
5883 [UNIVERSE addMessage:DESC(@"incoming-missile") forCount:4.5];
5886 if ([ms isEqual:
@"ENERGY_LOW"])
5888 [UNIVERSE addMessage:DESC(@"energy-low") forCount:6.0];
5893 if ([ms isEqual:
@"DOCKING_REFUSED"] && [
self status] == STATUS_AUTOPILOT_ENGAGED)
5896 [UNIVERSE addMessage:DESC(@"autopilot-denied") forCount:4.5];
5908 if ([ms isEqual:
@"AEGIS_CLOSE_TO_MAIN_PLANET"]&&(
compassMode == COMPASS_MODE_PLANET))
5913 if ([ms isEqual:
@"AEGIS_IN_DOCKING_RANGE"]&&(
compassMode == COMPASS_MODE_PLANET))
5918 if ([ms isEqual:
@"AEGIS_NONE"]&&(
compassMode == COMPASS_MODE_STATION))
5865- (void) interpretAIMessage:(NSString *)ms {
…}
5928 if (missile ==
nil)
return NO;
5947- (BOOL) mountMissileWithRole:(NSString *)role
5950 return [
self mountMissile:[[UNIVERSE newShipWithRole:role] autorelease]];
5947- (BOOL) mountMissileWithRole:(NSString *)role {
…}
5960 if (missile ==
nil)
return nil;
5984 if (firedMissile !=
nil)
6002 return firedMissile;
6019 float mine_speed = 500.0f;
6020 Vector mvel = vector_subtract([mine
velocity], vector_multiply_scalar(
v_forward, mine_speed));
6027- (BOOL) assignToActivePylon:(NSString *)equipmentKey
6033 if ([equipmentKey hasSuffix:
@"_DAMAGED"])
6048 ShipEntity *amiss = [UNIVERSE newShipWithRole:equipmentKey];
6050 if (!amiss)
return NO;
6027- (BOOL) assignToActivePylon:(NSString *)equipmentKey {
…}
6074 [UNIVERSE setCurrentPostFX:OO_POSTFX_CLOAK];
6075 [UNIVERSE addMessage:DESC(@"cloak-on") forCount:2];
6081 [UNIVERSE addMessage:DESC(@"cloak-low-juice") forCount:3];
6093 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
6094 [UNIVERSE addMessage:DESC(@"cloak-off") forCount:2];
6175- (void) setWeaponsOnline:(BOOL)newValue
6175- (void) setWeaponsOnline:(BOOL)newValue {
…}
6200 [UNIVERSE addMessage:DESC(@"weapon-overheat") forCount:3.0];
6211 NSUInteger multiplier = 1;
6220 [UNIVERSE addMessage:DESC(@"weapon-out-of-juice") forCount:3.0];
6254 BOOL weaponFired = NO;
6257 if (![weapon_to_be_fired isTurretLaser])
6309- (GLfloat) doesHitLine:(HPVector)v0 :(HPVector)v1 :(
ShipEntity **)hitEntity
6313 Vector u0 = HPVectorToVector(HPvector_between(
position, v0));
6314 Vector u1 = HPVectorToVector(HPvector_between(
position, v1));
6315 Vector w0 = make_vector(dot_product(u0,
v_right), dot_product(u0,
v_up), dot_product(u0,
v_forward));
6316 Vector w1 = make_vector(dot_product(u1,
v_right), dot_product(u1,
v_up), dot_product(u1,
v_forward));
6317 GLfloat hit_distance = [
octree isHitByLine:w0 :w1];
6321 hitEntity[0] =
self;
6324 bool shields =
false;
6330 NSEnumerator *subEnum =
nil;
6336 u0 = HPVectorToVector(HPvector_between(p0, v0));
6337 u1 = HPVectorToVector(HPvector_between(p0, v1));
6338 w0 = resolveVectorInIJK(u0, ijk);
6339 w1 = resolveVectorInIJK(u1, ijk);
6341 GLfloat hitSub = [
se->octree isHitByLine:w0 :w1];
6342 if (hitSub && (hit_distance == 0 || hit_distance > hitSub))
6344 hit_distance = hitSub;
6345 if (hitEntity && !shields)
6352 return hit_distance;
6309- (GLfloat) doesHitLine:(HPVector)v0 :(HPVector)v1 :(
ShipEntity **)hitEntity {
…}
6357- (void) takeEnergyDamage:(
double)amount from:(
Entity *)ent becauseOf:(
Entity *)other weaponIdentifier:(NSString *)weaponIdentifier
6361 BOOL internal_damage = NO;
6363 OOLog(
@"player.ship.damage",
@"Player took damage from %@ becauseOf %@", ent, other);
6365 if ([
self status] == STATUS_DEAD)
return;
6366 if ([
self status] == STATUS_ESCAPE_SEQUENCE)
return;
6367 if (amount == 0.0)
return;
6370 BOOL cascading = NO;
6379 [[
ent retain] autorelease];
6380 [[
other retain] autorelease];
6383 rel_pos = HPvector_subtract(rel_pos,
position);
6388 d_forward = dot_product(HPVectorToVector(rel_pos),
v_forward);
6389 d_right = dot_product(HPVectorToVector(rel_pos),
v_right);
6390 d_up = dot_product(HPVectorToVector(rel_pos),
v_up);
6391 Vector relative = make_vector(d_right,d_up,d_forward);
6428 OOShipDamageType damageType = cascadeWeapon ? kOODamageTypeCascadeWeapon : kOODamageTypeEnergy;
6447 if (cascading)
energy = 0.0;
6460 while (amount > 0.0)
6463 if (internal_damage)
6357- (void) takeEnergyDamage:(
double)amount from:(
Entity *)ent becauseOf:(
Entity *)other weaponIdentifier:(NSString *)weaponIdentifier {
…}
6473- (void) takeScrapeDamage:(
double) amount from:(
Entity *) ent
6477 BOOL internal_damage = NO;
6479 if ([
self status] == STATUS_DEAD)
return;
6483 OOLog(
@"player.ship.damage",
@"Player took negative scrape damage %.3f so we made it positive", amount);
6486 OOLog(
@"player.ship.damage",
@"Player took %.3f scrape damage from %@", amount, ent);
6488 [[
ent retain] autorelease];
6490 rel_pos = HPvector_subtract(rel_pos,
position);
6492 d_forward = dot_product(HPVectorToVector(rel_pos),
v_forward);
6493 d_right = dot_product(HPVectorToVector(rel_pos),
v_right);
6494 d_up = dot_product(HPVectorToVector(rel_pos),
v_up);
6495 Vector relative = make_vector(d_right,d_up,d_forward);
6527 while (amount > 0.0)
6530 if (internal_damage)
6473- (void) takeScrapeDamage:(
double) amount from:(
Entity *) ent {
…}
6539- (void) takeHeatDamage:(
double) amount
6541 if ([
self status] == STATUS_DEAD || amount < 0)
return;
6544 float fwd_amount = (float)(0.5 * amount);
6545 float aft_amount = (float)(0.5 * amount);
6569 double residual_amount = fwd_amount + aft_amount;
6539- (void) takeHeatDamage:(
double) amount {
…}
6587 [
result setRoll:flightRoll];
6588 [
result setBehaviour:BEHAVIOUR_IDLE];
6589 [
result switchAITo:@"nullAI.plist"];
6591 [
result copyValuesFromPlayer:
self];
6604 [UNIVERSE setViewDirection:VIEW_FORWARD];
6606 if ([
self status] == STATUS_DEAD)
return nil;
6613 [UNIVERSE setBlockJSPlayerShipProps:YES];
6637 [UNIVERSE addEntity:doppelganger];
6641 [
self setStatus:STATUS_ESCAPE_SEQUENCE];
6646 position = HPvector_subtract(
position, vectorToHPVector(vector_multiply_scalar(
v_up, sheight)));
6651 escapePod = [UNIVERSE newShipWithName:@"escape-capsule"];
6652 if (escapePod !=
nil)
6674 Vector launchVector = vector_add([doppelganger
velocity],
6675 vector_add(vector_multiply_scalar(
v_up, 15.0f),
6676 vector_multiply_scalar(
v_forward, -90.0f)));
6714 [cargo removeAllObjects];
6717 [UNIVERSE addMessage:DESC(@"escape-sequence") forCount:4.5];
6729 return doppelganger;
6737 [UNIVERSE addMessage:OOExpandKey(@"hold-locked") forCount:3.0];
6744 NSString *commodity = [UNIVERSE displayNameForCommodity:result];
6745 [UNIVERSE addMessage:OOExpandKey(@"commodity-ejected", commodity) forCount:3.0 forceDisplay:YES];
6754 NSInteger i, n_cargo = [cargo count];
6755 if (n_cargo == 0)
return;
6760 NSInteger rotates = 0;
6764 [cargo removeObjectAtIndex:0];
6765 [cargo addObject:pod];
6770 }
while ([contents isEqualToString:current_contents]&&(rotates < n_cargo));
6773 NSString *commodity = [UNIVERSE displayNameForCommodity:contents];
6774 [UNIVERSE addMessage:OOExpandKey(@"ready-to-eject-commodity", commodity) forCount:3.0];
6778 for (i = 1; i < (n_cargo - rotates); i++)
6780 pod = [cargo objectAtIndex:i];
6784 [cargo removeObjectAtIndex:i--];
6785 [cargo addObject:pod];
6810 jsval amountVal = JSVAL_VOID;
6812 JS_NewNumberValue(context, amountVal2, &amountVal);
6818 ShipScriptEvent(context,
self,
"shipBountyChanged", amountVal, reasonVal);
6836- (void) markAsOffender:(
int)offence_value
6836- (void) markAsOffender:(
int)offence_value {
…}
6848 jsval amountVal = JSVAL_VOID;
6850 JS_NewNumberValue(context, amountVal2, &amountVal);
6856 ShipScriptEvent(context,
self,
"shipBountyChanged", amountVal, reasonVal);
6866 if ([
self status] == STATUS_DEAD)
return;
6894 if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
6897 if (![other hasRole:
@"tharglet"])
6909 [UNIVERSE addDelayedMessage:bonusMessage forCount:6 afterDelay:0.15];
6918 [UNIVERSE addDelayedMessage:DESC(@"right-on-commander") forCount:4 afterDelay:0.2];
6927 unsigned n_mass = [
self mass] / 10000;
6929 unsigned damage_to = n_considered ? (
ranrot_rand() % n_considered) : 0;
6935 NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[
pod commodityType]];
6938 [UNIVERSE clearPreviousMessage];
6939 [UNIVERSE addMessage:[
NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
6940 [cargo removeObject:pod];
6945 damage_to = n_considered - (damage_to + 1);
6950 NSString *system_key;
6951 unsigned damageableCounter = 0;
6952 GLfloat damageableOdds = 0.0;
6953 while ((system_key = [eqEnum nextObject]) !=
nil)
6956 if ([eqType canBeDamaged])
6958 damageableCounter++;
6963 if (damage_to < damageableCounter)
6965 GLfloat target =
randf() * damageableOdds;
6966 GLfloat accumulator = 0.0;
6968 while ((system_key = [eqEnum nextObject]) !=
nil)
6972 if (accumulator > target)
6978 if (system_key ==
nil)
6985 if (![eqType canBeDamaged] || system_name ==
nil)
6993 [UNIVERSE clearPreviousMessage];
6996 NSString *damagedKey = [
NSString stringWithFormat:@"%@_DAMAGED", system_key];
7000 if (![
self hasEquipmentItem:system_name] && [
self hasEquipmentItem:damagedKey])
7008 [UNIVERSE addMessage:[
NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
7033 if (![[
UNIVERSE gameController] playerFileToLoad])
7035 [[UNIVERSE gameController] setPlayerFileToLoad: save_path];
7042 [UNIVERSE setDisplayText:NO];
7043 [UNIVERSE setViewDirection:VIEW_AFT];
7056 [[UNIVERSE messageGUI] clear];
7059 [UNIVERSE setBlockJSPlayerShipProps:YES];
7070 int ent_count =
UNIVERSE->n_entities;
7074 for (i = 0; i < ent_count; i++)
7075 my_entities[i] = [uni_entities[i] retain];
7076 for (i = 0; i < ent_count ; i++)
7078 Entity* thing = my_entities[
i];
7088 for (i = 0; i < ent_count; i++)
7095- (BOOL) endScenario:(NSString *)key
7095- (BOOL) endScenario:(NSString *)key {
…}
7108 NSParameterAssert(station !=
nil);
7109 if ([
self status] == STATUS_DEAD)
return;
7115 if (![
hud nonlinearScanner])
7132 [UNIVERSE setDisplayText:NO];
7133 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7134 if ([
self status] == STATUS_LAUNCHING)
return;
7137 [UNIVERSE setUpBreakPattern:[
self breakPatternPosition] orientation:orientation forDocking:YES];
7141 [[UNIVERSE gameView] clearKeys];
7155 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
7194 if ([
self bounty] > oldbounty)
7204 [UNIVERSE setDisplayText:YES];
7231 if ([
self status] == STATUS_LAUNCHING)
return;
7248 if (station ==
nil)
return;
7252 [[UNIVERSE gameView] allowStringInput: NO];
7256 [[UNIVERSE gui] clearBackground];
7265 if ([station marketMonitored])
7270 if ([
self bounty] > oldbounty)
7279 if (![
hud nonlinearScanner])
7310 [UNIVERSE setDisplayText:NO];
7311 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7313 [[UNIVERSE gameView] clearKeys];
7317 [[UNIVERSE gameView] resetMouse];
7322 [UNIVERSE forceWitchspaceEntries];
7330 [UNIVERSE setUpBreakPattern:[
self breakPatternPosition] orientation:orientation forDocking:YES];
7339 [UNIVERSE removeDemoShips];
7354 if (![hud nonlinearScanner])
7356 [
hud setScannerZoom: 1.0];
7360 OOViewID previousViewDirection = [UNIVERSE viewDirection];
7361 [UNIVERSE setViewDirection:VIEW_FORWARD];
7368 suppressAegisMessages=YES;
7369 hyperspeed_engaged = NO;
7371 if ([
self primaryTarget] !=
nil)
7377 scanner_zoom_rate = 0.0f;
7378 [UNIVERSE setDisplayText:NO];
7380 if ( ![
self wormhole] && !galactic_witchjump)
7384 [UNIVERSE allShipsDoScriptEvent:OOJSID("playerWillEnterWitchspace") andReactToAIMessage:@"PLAYER WITCHSPACE"];
7395 [UNIVERSE setSystemTo:system_id];
7396 galaxy_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:system_id inGalaxy:galaxy_number];
7398 [UNIVERSE setUpUniverseFromWitchspace];
7399 [[UNIVERSE planet] update: 2.34375 * market_rnd];
7400 [[UNIVERSE station] update: 2.34375 * market_rnd];
7402 chart_centre_coordinates = galaxy_coordinates;
7403 target_chart_centre = chart_centre_coordinates;
7407- (BOOL) witchJumpChecklist:(BOOL)isGalacticJump
7410 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
7417 [UNIVERSE clearPreviousMessage];
7419 [UNIVERSE addMessage:OOExpandKey(@"witch-blocked", blockerName) forCount:4.5];
7438 [UNIVERSE clearPreviousMessage];
7439 [UNIVERSE addMessage:OOExpandKey(@"witch-no-target") forCount: 4.5];
7440 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
7454 [UNIVERSE clearPreviousMessage];
7455 [UNIVERSE addMessage:DESC(@"witch-too-far") forCount: 4.5];
7456 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
7470 [UNIVERSE clearPreviousMessage];
7471 [UNIVERSE addMessage:DESC(@"witch-no-fuel") forCount: 4.5];
7472 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
7407- (BOOL) witchJumpChecklist:(BOOL)isGalacticJump {
…}
7487- (void) setJumpType:(BOOL)isGalacticJump
7487- (void) setJumpType:(BOOL)isGalacticJump {
…}
7503 NSPoint targetCoordinates =
PointFromString([[
UNIVERSE systemManager] getProperty:
@"coordinates" forSystem:[
self nextHopTargetSystemID] inGalaxy:galaxy_number]);
7522 if ([[
self hud] isCompassActive])
7527 ShipScriptEvent(context,
self,
"compassTargetChanged", JSVAL_VOID, jsmode);
7537 if (![
self witchJumpChecklist:
true])
7548 [
self setStatus:STATUS_ENTERING_WITCHSPACE];
7552 ShipScriptEvent(context,
self,
"shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[
self jumpCause] UTF8String])), INT_TO_JSVAL(destGalaxy));
7559 [UNIVERSE removeAllEntitiesExceptPlayer];
7563 [contracts removeAllObjects];
7566 [parcels removeAllObjects];
7570 [missionDestinations removeAllObjects];
7576 for (i = 0; i < [passengers count]; i++)
7579 NSMutableDictionary* passenger_info = [
NSMutableDictionary dictionaryWithDictionary:[passengers oo_dictionaryAtIndex:i]];
7581 [passengers replaceObjectAtIndex:i withObject:passenger_info];
7598 [roleWeightFlags removeAllObjects];
7599 [roleSystemList removeAllObjects];
7606 [UNIVERSE setGalaxyTo:galaxy_number];
7615 case GALACTIC_HYPERSPACE_BEHAVIOUR_FIXED_COORDINATES:
7616 system_id = [UNIVERSE findSystemNumberAtCoords:galacticHyperspaceFixedCoords withGalaxy:galaxy_number includingHidden:YES];
7618 case GALACTIC_HYPERSPACE_BEHAVIOUR_ALL_SYSTEMS_REACHABLE:
7619 system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
7621 case GALACTIC_HYPERSPACE_BEHAVIOUR_STANDARD:
7624 system_id = [UNIVERSE findConnectedSystemAtCoords:galaxy_coordinates withGalaxy:galaxy_number];
7641 if ([
self status] == STATUS_ENTERING_WITCHSPACE
7642 || [
self status] == STATUS_EXITING_WITCHSPACE)
7649 [
self setStatus:STATUS_ENTERING_WITCHSPACE];
7659#ifdef OO_DUMP_PLANETINFO
7672 if (![
self witchJumpChecklist:
false])
return;
7677 unsigned malfunc_chance = 253;
7684 malfunc_chance = 256;
7687#ifdef OO_DUMP_PLANETINFO
7690 BOOL malfunc = ((
ranrot_rand() & 0xff) > malfunc_chance);
7694 if (malfunc && !misjump)
7718 [UNIVERSE addEntity:wormhole];
7721 [
self setStatus:STATUS_ENTERING_WITCHSPACE];
7725 ShipScriptEvent(context,
self,
"shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[
self jumpCause] UTF8String])), INT_TO_JSVAL(jumpTarget));
7734 if (maxSpace != availSpace)
7737 if (maxSpace - availSpace > 20 || availSpace == 0)
7748 if (maxSpace != availSpace && legality > 0)
7751 if (maxSpace - availSpace > 20 || availSpace == 0)
7753 if (legality >= 20 || legality >= maxSpace)
7760 [roleWeightFlags removeAllObjects];
7778 if (info_system_id == system_id)
7783 if (2 * market_rnd < ship_trade_in_factor)
7790 NSPoint destCoords =
PointFromString([[
UNIVERSE systemManager] getProperty:
@"coordinates" forSystem:sTo inGalaxy:galaxy_number]);
7795 if (theSun && [theSun goneNova])
7800 [UNIVERSE removeAllEntitiesExceptPlayer];
7803 ship_clock_adjust += distance * distance * 3600.0;
7820 NSPoint dest = [
wormhole destinationCoordinates];
7821 galaxy_coordinates.x = dest.x;
7822 galaxy_coordinates.y = dest.y;
7824 ship_clock_adjust += [
wormhole travelTime];
7827 [UNIVERSE setUpUniverseFromMisjump];
7835 HPVector pos = [UNIVERSE getWitchspaceExitPosition];
7837 HPVector whpos, exitpos;
7839 double min_d1 = [UNIVERSE safeWitchspaceExitDistance];
7841 if (abs((
int)d1) < min_d1)
7843 d1 += ((d1 > 0.0)? min_d1: -min_d1);
7846 exitpos = HPvector_add(pos, HPvector_multiply_scalar(v1, d1));
7860 if (wh_arrival_time > 0)
7863 whpos = HPvector_add(exitpos, vectorToHPVector(vector_multiply_scalar([
self forwardVector], 1000.0f)));
7869 whpos = HPvector_add(exitpos, vectorToHPVector(vector_multiply_scalar([
self forwardVector], -500.0f)));
7874 HPVector distance = HPvector_subtract(whpos, pos);
7875 if (HPmagnitude2(distance) < min_d1*min_d1 )
7879 distance = HPvector_multiply_scalar(HPvector_normal(distance), min_d1);
7880 whpos = HPvector_add(whpos, distance);
7904 [
self setStatus:STATUS_EXITING_WITCHSPACE];
7909 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7910 [UNIVERSE setDisplayText:NO];
7911 [UNIVERSE setWitchspaceBreakPattern:YES];
7928 [UNIVERSE setUpBreakPattern:[
self breakPatternPosition] orientation:orientation forDocking:NO];
7936 NSString *systemName =
nil;
7937 NSString *targetSystemName =
nil;
7938 NSString *text =
nil;
7942 if (oldScreen != GUI_SCREEN_STATUS)
7950 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
7954 systemName = [UNIVERSE inInterstellarSpace] ?
DESC(
@"interstellar-space") : [UNIVERSE getSystemName:system_id];
7960 targetSystemName = [UNIVERSE getSystemName:target_system_id];
7961 NSDictionary *systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:target_system_id inGalaxy:galaxy_number];
7962 NSInteger concealment = [
systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7967 NSString *nextHopSystemName = [UNIVERSE getSystemName:nextHop];
7968 systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:nextHop inGalaxy:galaxy_number];
7969 concealment = [
systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7971 targetSystemName =
OOExpandKey(
@"status-hyperspace-system-multi", targetSystemName, nextHopSystemName);
7977 NSString *legal_desc =
nil, *rating_desc =
nil,
7978 *alert_desc =
nil, *fuel_desc =
nil,
7979 *credits_desc =
nil;
7989 NSString *lightYearsDesc =
DESC(
@"status-light-years-desc");
7994 fuel_desc = [
NSString stringWithFormat:@"%.1f %@", fuel/10.0, lightYearsDesc];
7998 text =
DESC(
@"status-commander-@");
8013 for (i = 1 ; i <= 7 ; ++i)
8029 [lastTextKey release];
8033 [[UNIVERSE gameView] clearMouse];
8036 if (
EXPECT_NOT([[NSUserDefaults standardUserDefaults] boolForKey:
@"show-ship-model-in-status-screen"]))
8038 [UNIVERSE removeDemoShips];
8048 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8052 NSDictionary *fgDescriptor =
nil, *bgDescriptor =
nil;
8053 if ([
self status] == STATUS_DOCKED)
8055 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"docked_overlay"];
8056 bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_docked"];
8060 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"overlay"];
8062 else bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_in_flight"];
8067 if (bgDescriptor ==
nil) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status"];
8081 NSEnumerator *eqTypeEnum =
nil;
8083 NSString *desc =
nil;
8084 NSString *alldesc =
nil;
8086 BOOL prioritiseDamaged = [[
gui userSettings] oo_boolForKey:kGuiStatusPrioritiseDamaged defaultValue:YES];
8092 if ([eqType canCarryMultiple] && ![eqType isMissileOrMine])
8094 NSString *damagedIdentifier = [[
eqType identifier] stringByAppendingString:@"_DAMAGED"];
8095 NSUInteger
count = 0, okcount = 0;
8103 else if (
count == okcount)
8119 else if (
count == 1 && okcount == 0)
8121 desc = [
NSString stringWithFormat:DESC(@"equipment-@-not-available"), [
eqType name]];
8122 if (prioritiseDamaged)
8135 alldesc =
OOExpandKey(
@"equipment-plural-some-na", okcount,
count, equipmentName);
8136 if (prioritiseDamaged)
8146 else if ([
self hasEquipmentItem:[eqType identifier]])
8153 if ([
self hasEquipmentItem:[[eqType identifier] stringByAppendingString:
@"_DAMAGED"]])
8155 desc = [
NSString stringWithFormat:DESC(@"equipment-@-not-available"), [
eqType name]];
8157 if (prioritiseDamaged)
8173 desc = [
NSString stringWithFormat:DESC_PLURAL(@"equipment-pass-berth-@", max_passengers), max_passengers];
8199 [
quip1 addObjectsFromArray:quip2];
8206 return [eqScripts count];
8210- (NSString *) primedEquipmentName:(NSInteger)offset
8216 return DESC(
@"equipment-primed-none-hud-label");
8210- (NSString *) primedEquipmentName:(NSInteger)offset {
…}
8227 NSString *result =
@"";
8228 NSUInteger c = [eqScripts count];
8231 result = [[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
8237- (BOOL) setPrimedEquipment:(NSString *)eqKey showMessage:(BOOL)showMsg
8239 NSUInteger c = [eqScripts count];
8242 BOOL unprimeEq = [
eqKey isEqualToString:@""];
8255 [UNIVERSE addMessage:unprimeEq ? OOExpandKey(@"equipment-primed-none") : OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
8237- (BOOL) setPrimedEquipment:(NSString *)eqKey showMessage:(BOOL)showMsg {
…}
8267 OOJSScript *eqScript = [[eqScripts oo_arrayAtIndex:index] objectAtIndex:1];
8298- (void) setFastEquipmentA:(NSString *)eqKey
8300 [_fastEquipmentA release];
8298- (void) setFastEquipmentA:(NSString *)eqKey {
…}
8305- (void) setFastEquipmentB:(NSString *)eqKey
8307 [_fastEquipmentB release];
8305- (void) setFastEquipmentB:(NSString *)eqKey {
…}
8353 NSEnumerator *cargoEnum =
nil;
8354 NSDictionary *commodity;
8358 for (cargoEnum = [list objectEnumerator]; (commodity = [
cargoEnum nextObject]); )
8360 NSInteger quantity = [
commodity oo_integerForKey:@"quantity"];
8361 NSString *units = [
commodity oo_stringForKey:@"unit"];
8362 NSString *commodityName = [
commodity oo_stringForKey:@"displayName"];
8363 NSInteger containers = [
commodity oo_intForKey:@"containers"];
8364 BOOL extended = ![
units isEqualToString:DESC(@"cargo-tons-symbol")] && containers > 0;
8367 [
manifest addObject:OOExpandKey(@"manifest-cargo-quantity-extended", quantity, units, commodityName, containers)];
8369 [
manifest addObject:OOExpandKey(@"manifest-cargo-quantity", quantity, units, commodityName)];
8387 for (i = 0; i < commodityCount; i++)
8390 containersInHold[
i] = 0;
8392 for (i = 0; i < [cargo count]; i++)
8394 ShipEntity *container = [cargo objectAtIndex:i];
8397 ++containersInHold[
j];
8400 for (i = 0; i < commodityCount; i++)
8402 if (quantityInHold[i] > 0)
8405 NSString *symName = [
goods oo_stringAtIndex:i];
8407 [
commodity setObject:symName forKey:@"commodity"];
8408 [
commodity setObject:[
NSNumber numberWithUnsignedInt:quantityInHold[
i]] forKey:@"quantity"];
8409 [
commodity setObject:[
NSNumber numberWithUnsignedInt:containersInHold[
i]] forKey:@"containers"];
8411 [
commodity setObject:DisplayStringForMassUnitForCommodity(symName) forKey:@"unit"];
8412 [
list addObject:commodity];
8416 return [[
list copy] autorelease];
8423 NSString *good =
nil;
8425 unsigned penalty = 0;
8436- (NSArray*) contractsListForScriptingFromArray:(NSArray *) contracts_array forCargo:(BOOL)forCargo
8448 [
contract setObject:[
dict oo_stringForKey:CARGO_KEY_TYPE] forKey:@"commodity"];
8449 [
contract setObject:[
NSNumber numberWithUnsignedInt:[
dict oo_intForKey:CARGO_KEY_AMOUNT]] forKey:@"quantity"];
8450 [
contract setObject:[
dict oo_stringForKey:CARGO_KEY_DESCRIPTION] forKey:@"description"];
8454 [
contract setObject:[
dict oo_stringForKey:PASSENGER_KEY_NAME] forKey:PASSENGER_KEY_NAME];
8455 [
contract setObject:[
NSNumber numberWithUnsignedInt:[
dict oo_unsignedIntForKey:CONTRACT_KEY_RISK]] forKey:CONTRACT_KEY_RISK];
8458 OOSystemID planet = [
dict oo_intForKey:CONTRACT_KEY_DESTINATION];
8459 NSString *planetName = [UNIVERSE getSystemName:planet];
8460 [
contract setObject:[
NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_DESTINATION];
8461 [
contract setObject:planetName forKey:@"destinationName"];
8462 planet = [
dict oo_intForKey:CONTRACT_KEY_START];
8463 planetName = [UNIVERSE getSystemName: planet];
8464 [
contract setObject:[
NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_START];
8465 [
contract setObject:planetName forKey:@"startName"];
8467 int dest_eta = [
dict oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
8469 [
contract setObject:[UNIVERSE shortTimeDescription:dest_eta] forKey:@"etaDescription"];
8470 [
contract setObject:[
NSNumber numberWithInt:[
dict oo_intForKey:CONTRACT_KEY_PREMIUM]] forKey:CONTRACT_KEY_PREMIUM];
8471 [
contract setObject:[
NSNumber numberWithInt:[
dict oo_intForKey:CONTRACT_KEY_FEE]] forKey:CONTRACT_KEY_FEE];
8472 [
result addObject:contract];
8475 return [[
result copy] autorelease];
8436- (NSArray*) contractsListForScriptingFromArray:(NSArray *) contracts_array forCargo:(BOOL)forCargo {
…}
8501- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground
8503 NSDictionary *infoSystemData;
8504 NSString *infoSystemName;
8506 infoSystemData = [[UNIVERSE generateSystemData:info_system_id] retain];
8507 NSInteger concealment = [
infoSystemData oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
8510 BOOL sunGoneNova = ([
infoSystemData oo_boolForKey:@"sun_gone_nova"]);
8517 Random_Seed infoSystemRandomSeed = [[UNIVERSE systemManager] getRandomSeedForSystem:info_system_id
8520 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
8531 NSUInteger techLevel = [
infoSystemData oo_intForKey:KEY_TECHLEVEL] + 1;
8533 int productivity = [
infoSystemData oo_intForKey:KEY_PRODUCTIVITY];
8536 NSString *government_desc = [
infoSystemData oo_stringForKey:KEY_GOVERNMENT_DESC
8537 defaultValue:OODisplayStringFromGovernmentID([
infoSystemData oo_intForKey:KEY_GOVERNMENT])];
8538 NSString *economy_desc = [
infoSystemData oo_stringForKey:KEY_ECONOMY_DESC
8539 defaultValue:OODisplayStringFromEconomyID([
infoSystemData oo_intForKey:KEY_ECONOMY])];
8540 NSString *inhabitants = [
infoSystemData oo_stringForKey:KEY_INHABITANTS];
8541 NSString *system_desc = [
infoSystemData oo_stringForKey:KEY_DESCRIPTION];
8543 NSString *populationDesc = [
infoSystemData oo_stringForKey:KEY_POPULATION_DESC
8544 defaultValue:OOExpandKeyWithSeed(kNilRandomSeed, @"sysdata-pop-value", population)];
8557 NSString *system = infoSystemName;
8558 system_desc =
OOExpandKeyWithSeed(infoSystemRandomSeed,
@"nova-system-description", system);
8560 populationDesc =
OOExpandKeyWithSeed(infoSystemRandomSeed,
@"sysdata-pop-value", population);
8565 [UNIVERSE removeDemoShips];
8569 NSString *system = infoSystemName;
8570 [
gui setTitle:OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-data-on-system", system)];
8574 [
gui setTitle:OOExpandKey(@"sysdata-data-on-system-no-name")];
8581 for (i-- ; i > 14 ; --i)
8588 NSPoint infoSystemCoordinates = [[UNIVERSE systemManager] getCoordinatesForSystem: info_system_id inGalaxy: galaxy_number];
8594 NSString *distanceInfo = [
NSString stringWithFormat: @"%.1f ly", distance];
8597 NSDictionary *routeInfo =
nil;
8598 routeInfo = [UNIVERSE routeFromSystem: system_id toSystem: info_system_id optimizedBy: ANA_mode];
8599 if (routeInfo !=
nil)
8601 double routeDistance = [[
routeInfo objectForKey: @"distance"] doubleValue];
8602 double routeTime = [[
routeInfo objectForKey: @"time"] doubleValue];
8603 int routeJumps = [[
routeInfo objectForKey: @"jumps"] intValue];
8605 routeDistance = 0.1;
8609 distanceInfo = [
NSString stringWithFormat: @"%.1f ly / %.1f %@ / %d %@",
8613 routeTime > 1.05 || routeTime < 0.95 ? DESC(@"sysdata-route-hours%1") : DESC(@"sysdata-route-hours%0"),
8615 DESC_PLURAL(@"sysdata-route-jumps", routeJumps)];
8621 for (i = 1; i <= 16; i++) {
8622 NSString *ln = [
NSString stringWithFormat:@"sysdata-line-%ld", (long)i];
8623 NSString *line =
OOExpandKeyWithSeed(infoSystemRandomSeed, ln, economy_desc, government_desc, techLevel, populationDesc, inhabitants, productivity, radius, distanceInfo);
8624 if (![line isEqualToString:
@""])
8626 NSArray *lines = [
line componentsSeparatedByString:@"\t"];
8627 if ([lines
count] == 1)
8633 if ([lines
count] == 2)
8636 [
lines objectAtIndex:1],
8640 if ([lines
count] == 3)
8642 if ([[lines objectAtIndex:2] isEqualToString:
@""])
8645 [
lines objectAtIndex:1],
8652 [
lines objectAtIndex:1],
8653 [
lines objectAtIndex:2],
8670 for (i-- ; i > 16 ; --i)
8674 for (i = 1 ; i <= 14 ; ++i)
8685 [lastTextKey release];
8688 [[UNIVERSE gameView] clearMouse];
8693 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8716 if (refreshBackground || guiChanged)
8501- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground {
…}
8727- (void) prepareMarkedDestination:(NSMutableDictionary *)markers :(NSDictionary *)marker
8729 NSNumber *key = [
NSNumber numberWithInt:[
marker oo_intForKey:@"system"]];
8730 NSMutableArray *list = [
markers objectForKey:key];
8737 [
list addObject:marker];
8739 [
markers setObject:list forKey:key];
8727- (void) prepareMarkedDestination:(NSMutableDictionary *)markers :(NSDictionary *)marker {
…}
8749 NSDictionary *marker;
8751 for (i = 0; i < [passengers count]; i++)
8753 sysid = [[passengers oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8755 [
self prepareMarkedDestination:destinations:marker];
8757 for (i = 0; i < [parcels count]; i++)
8759 sysid = [[parcels oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8761 [
self prepareMarkedDestination:destinations:marker];
8763 for (i = 0; i < [contracts count]; i++)
8765 sysid = [[contracts oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8767 [
self prepareMarkedDestination:destinations:marker];
8770 NSEnumerator *keyEnum =
nil;
8771 NSString *key =
nil;
8775 marker = [missionDestinations objectForKey:key];
8776 [
self prepareMarkedDestination:destinations:marker];
8779 return destinations;
8811 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8813 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
8815 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
8833 if (
gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
8835 NSString *displaySearchString =
planetSearchString ? [planetSearchString capitalizedString] : (NSString *)
@"";
8836 [
gui setText:[
NSString stringWithFormat:DESC(@"long-range-chart-find-planet-@"), displaySearchString]
forRow:GUI_ROW_PLANET_FINDER];
8849 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
8858 [UNIVERSE findSystemCoordinatesWithPrefix:[[UNIVERSE getSystemName:found_system_id] lowercaseString] exactMatch:YES];
8867 NSString *filledSlider = [@"|||||||||||||||||||||||||"
substringToIndex:amountIn20ths];
8868 NSString *emptySlider = [@"........................."
substringToIndex:20 - amountIn20ths];
8869 return [
NSString stringWithFormat:@"%@%@", filledSlider, emptySlider];
8877 [[UNIVERSE gameView] clearMouse];
8878 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8882 #define OO_SETACCESSCONDITIONFORROW(condition, row) \
8886 [gui setKey:GUI_KEY_OK forRow:(row)]; \
8890 [gui setColor:[OOColor grayColor] forRow:(row)]; \
8893 BOOL startingGame = [
self status] == STATUS_START_GAME;
8902#if OO_RESOLUTION_OPTION
8906 if (displayModeIndex == NSNotFound)
8908 OOLogWARN(
@"display.currentMode.notFound",
@"%@",
@"couldn't find current fullscreen setting, switching to default.");
8909 displayModeIndex = 0;
8914 if ([modeList
count])
8920 unsigned modeWidth = [mode oo_unsignedIntForKey:kOODisplayWidth];
8921 unsigned modeHeight = [mode oo_unsignedIntForKey:kOODisplayHeight];
8922 float modeRefresh = [mode oo_floatForKey:kOODisplayRefreshRate];
8926 if (!runningOnPrimaryDisplayDevice)
8928 MONITORINFOEX mInfo = [
gameView currentMonitorInfo];
8929 modeWidth = mInfo.rcMonitor.right - mInfo.rcMonitor.left;
8930 modeHeight = mInfo.rcMonitor.bottom - mInfo.rcMonitor.top;
8937 if (runningOnPrimaryDisplayDevice)
8949 if ([gameView hdrOutput])
8951 NSArray *brightnesses = [[UNIVERSE descriptions] oo_arrayForKey: @"hdr_maxBrightness_array"];
8954 if (brightnessIdx == NSNotFound)
8956 OOLogWARN(
@"hdr.maxBrightness.notFound",
@"%@",
@"couldn't find current max brightness setting, switching to 400 nits.");
8960 int brightnessValue = [
brightnesses oo_intAtIndex:brightnessIdx];
8961 NSString *maxBrightnessString =
OOExpandKey(
@"gameoptions-hdr-maxbrightness", brightnessValue);
8970 [
gui setText:DESC(@"gameoptions-autosave-yes")
forRow:GUI_ROW(GAME,AUTOSAVE)
align:GUI_ALIGN_CENTER];
8972 [
gui setText:DESC(@"gameoptions-autosave-no")
forRow:GUI_ROW(GAME,AUTOSAVE)
align:GUI_ALIGN_CENTER];
8976 if ([
OOSound respondsToSelector:
@selector(masterVolume)] && [
OOSound isSoundOK])
8979 int vol = (
volume / 5.0 + 0.5);
8980 NSString* soundVolumeWordDesc =
DESC(
@"gameoptions-sound-volume");
8982 [
gui setText:[
NSString stringWithFormat:@"%@%@ ", soundVolumeWordDesc, SliderString(vol)]
forRow:GUI_ROW(GAME,VOLUME)
align:GUI_ALIGN_CENTER];
8984 [
gui setText:DESC(@"gameoptions-sound-volume-mute")
forRow:GUI_ROW(GAME,VOLUME)
align:GUI_ALIGN_CENTER];
8989 [
gui setText:DESC(@"gameoptions-volume-external-only")
forRow:GUI_ROW(GAME,VOLUME)
align:GUI_ALIGN_CENTER];
8996 int gamma5 = (gamma * 5);
8997 NSString* gammaWordDesc =
DESC(
@"gameoptions-gamma-value");
8998 [
gui setText:[
NSString stringWithFormat:@"%@%@ (%.1f) ", gammaWordDesc, SliderString(gamma5), gamma]
forRow:GUI_ROW(GAME,GAMMA)
align:GUI_ALIGN_CENTER];
9005 NSString* fovWordDesc =
DESC(
@"gameoptions-fov-value");
9006 [
gui setText:[
NSString stringWithFormat:@"%@%@ (%d%c) ", fovWordDesc, SliderString(fovTicks), (int)fov, 176 ]
forRow:GUI_ROW(GAME,FOV)
align:GUI_ALIGN_CENTER];
9010 int colorblindMode = [UNIVERSE colorblindMode];
9011 NSString *colorblindModeDesc = [[[UNIVERSE descriptions] oo_arrayForKey: @"colorblind_mode"] oo_stringAtIndex:[UNIVERSE useShaders] ? colorblindMode : 0];
9012 NSString *colorblindModeMsg =
OOExpandKey(
@"gameoptions-colorblind-mode", colorblindModeDesc);
9023#if OOLITE_SPEECH_SYNTH
9028 [
gui setText:DESC(@"gameoptions-spoken-messages-no")
forRow:GUI_ROW(GAME,SPEECH)
align:GUI_ALIGN_CENTER];
9031 [
gui setText:DESC(@"gameoptions-spoken-messages-comms")
forRow:GUI_ROW(GAME,SPEECH)
align:GUI_ALIGN_CENTER];
9034 [
gui setText:DESC(@"gameoptions-spoken-messages-yes")
forRow:GUI_ROW(GAME,SPEECH)
align:GUI_ALIGN_CENTER];
9041 NSString *voiceName = [UNIVERSE voiceName:voice_no];
9042 NSString *message =
OOExpandKey(
@"gameoptions-voice-name", voiceName);
9046 message = [
NSString stringWithFormat:DESC(voice_gender_m ? @"gameoptions-voice-M" : @"gameoptions-voice-F")];
9054 if([gameView inFullScreenMode])
9056 [
gui setText:DESC(@"gameoptions-play-in-window")
forRow:GUI_ROW(GAME,DISPLAYSTYLE)
align:GUI_ALIGN_CENTER];
9060 [
gui setText:DESC(@"gameoptions-play-in-fullscreen")
forRow:GUI_ROW(GAME,DISPLAYSTYLE)
align:GUI_ALIGN_CENTER];
9065 [
gui setText:DESC(@"gameoptions-joystick-configuration")
forRow: GUI_ROW(GAME,STICKMAPPER)
align: GUI_ALIGN_CENTER];
9068 [
gui setText:DESC(@"gameoptions-keyboard-configuration")
forRow: GUI_ROW(GAME,KEYMAPPER)
align: GUI_ALIGN_CENTER];
9073 NSString *message =
OOExpandKey(
@"gameoptions-music-mode", musicMode);
9077 if (![gameView hdrOutput])
9080 [
gui setText:DESC(@"gameoptions-wireframe-graphics-yes")
forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS)
align:GUI_ALIGN_CENTER];
9082 [
gui setText:DESC(@"gameoptions-wireframe-graphics-no")
forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS)
align:GUI_ALIGN_CENTER];
9088 float paperWhite = [
gameView hdrPaperWhiteBrightness];
9090 NSString* paperWhiteWordDesc =
DESC(
@"gameoptions-hdr-paperwhite");
9091 [
gui setText:[
NSString stringWithFormat:@"%@%@ (%d) ", paperWhiteWordDesc, SliderString(paperWhiteTicks), (int)paperWhite]
forRow:GUI_ROW(GAME,HDRPAPERWHITE)
align:GUI_ALIGN_CENTER];
9097 if ([
UNIVERSE doProcedurallyTexturedPlanets])
9098 [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-yes")
forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)
align:GUI_ALIGN_CENTER];
9100 [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-no")
forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)
align:GUI_ALIGN_CENTER];
9101 [
gui setKey:GUI_KEY_OK
forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)];
9105 NSString *shaderEffectsOptionsString =
OOExpand(
@"gameoptions-detaillevel-[detailLevel]", detailLevel);
9106 [
gui setText:OOExpandKey(shaderEffectsOptionsString)
forRow:GUI_ROW(GAME,SHADEREFFECTS)
align:GUI_ALIGN_CENTER];
9118 if ([
UNIVERSE dockingClearanceProtocolActive])
9120 [
gui setText:DESC(@"gameoptions-docking-clearance-yes")
forRow:GUI_ROW(GAME,DOCKINGCLEARANCE)
align:GUI_ALIGN_CENTER];
9124 [
gui setText:DESC(@"gameoptions-docking-clearance-no")
forRow:GUI_ROW(GAME,DOCKINGCLEARANCE)
align:GUI_ALIGN_CENTER];
9145 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9151 BOOL gamePaused = [[UNIVERSE gameController] isGamePaused];
9152 BOOL canLoadOrSave = NO;
9156 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9158 if ([
self status] == STATUS_DOCKED)
9171 int first_sel_row = (canLoadOrSave)?
GUI_ROW(,SAVE) :
GUI_ROW(,GAMEOPTIONS);
9173 first_sel_row =
GUI_ROW(,QUICKSAVE);
9214 if (gamePaused || (!canLoadOrSave && [
self status] == STATUS_DOCKED))
9225 if ([gui setForegroundTextureKey:[
self status] == STATUS_DOCKED ?
@"docked_overlay" :
@"paused_overlay"] && [
UNIVERSE pauseMessageVisible])
9226 [[UNIVERSE messageGUI] clear];
9232 [[UNIVERSE gameView] clearMouse];
9237 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9241 [[UNIVERSE messageGUI] clear];
9242 NSString *pauseKey = [PLAYER keyBindingDescription2:@"key_pausebutton"];
9243 [UNIVERSE addMessage:OOExpandKey(@"game-paused-docked", pauseKey) forCount:1.0 forceDisplay:YES];
9253- (void) highlightEquipShipScreenKey:(NSString *)key
9257 NSString *otherKey =
@"";
9259 [last_outfitting_key release];
9281 if ([otherKey isEqualToString:key])
9288 if ([otherKey hasPrefix:
@"More:"])
9290 i = [[
otherKey componentsSeparatedByString:@":"] oo_intAtIndex:1];
9253- (void) highlightEquipShipScreenKey:(NSString *)key {
…}
9311- (void) setGuiToEquipShipScreen:(
int)skipParam selectingFacingFor:(NSString *)eqKeyForSelectFacing
9313 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9317 NSString *showKey =
nil;
9323 searchStatus = STATUS_TEST;
9328 searchStatus = STATUS_ACTIVE;
9335 double priceFactor = 1.0;
9336 OOTechLevelID techlevel = [[UNIVERSE currentSystemData] oo_intForKey:KEY_TECHLEVEL];
9355 [
options addObjectsFromArray:[[
shipyardInfo oo_dictionaryForKey:KEY_STANDARD_EQUIPMENT] oo_arrayForKey:KEY_EQUIPMENT_EXTRAS]];
9358 NSEnumerator *eqEnum =
nil;
9363 if (eqKeyForSelectFacing !=
nil)
9371 else for (eqEnum = [
OOEquipmentType equipmentEnumeratorOutfitting]; (eqType = [
eqEnum nextObject]); i++)
9380 if ([eqType isAvailableToAll]) [
options addObject:eqKey];
9383 if (minTechLevel != 0 && [
self hasEquipmentItem:[eqType damagedIdentifier]]) minTechLevel--;
9386 if (techlevel < minTechLevel && techlevel + 3 > minTechLevel)
9388 unsigned day = i * 13 + (unsigned)floor([
UNIVERSE getTime] / 86400.0);
9389 unsigned char dayRnd = (day & 0xff) ^ (
unsigned char)
system_id;
9392 while (minTechLevel > 0 && minTechLevel > originalMinTechLevel - 3 && !(dayRnd & 7))
9394 dayRnd = dayRnd >> 2;
9400 if ([options containsObject:eqKey])
9408 if (techlevel < minTechLevel) isOK = NO;
9409 if (![
self canAddEquipment:eqKey inContext:
@"purchase"]) isOK = NO;
9410 if (available_facings == 0 && [eqType isPrimaryWeapon]) isOK = NO;
9414 if (searchStatus == STATUS_DEAD && isOK)
9417 searchStatus = STATUS_ACTIVE;
9419 if (searchStatus == STATUS_TEST)
9421 if (isOK) showKey = eqKey;
9423 searchStatus = isOK ? STATUS_ACTIVE : STATUS_DEAD;
9426 if (searchStatus != STATUS_TEST && showKey !=
nil)
9428 [last_outfitting_key release];
9437 unsigned facing_count = 0;
9438 BOOL displayRow = YES;
9439 BOOL weaponMounted = NO;
9440 BOOL guiChanged = (
gui_screen != GUI_SCREEN_EQUIP_SHIP);
9446 [
gui setText:OOExpandKey(@"equip-cash-value", credits)
forRow:GUI_ROW_EQUIPMENT_CASH];
9450 tab_stops[1] = -360;
9451 tab_stops[2] = -480;
9464 if (
count <= n_rows || skip < n_rows)
9468 previous = skip - (n_rows - 2);
9473 if (eqKeyForSelectFacing !=
nil)
9488 for (i = skip; i <
count && (row - start_row < (
OOGUIRow)n_rows); i++)
9501 if ([eqKey isEqual:
@"EQ_FUEL"])
9505 else if ([eqKey isEqualToString:
@"EQ_RENOVATION"])
9512 price = pricePerUnit;
9517 price *= priceFactor;
9520 if (installTime == 0)
9522 installTime = 600 + price;
9525 if ([
self hasEquipmentItem:eq_key_damaged])
9527 desc = [
NSString stringWithFormat:DESC(@"equip-repair-@"), desc];
9530 if (installTime == 0)
9532 installTime = 600 + price;
9538 NSString *timeString = [UNIVERSE shortTimeDescription:installTime];
9539 NSString *priceString = [
NSString stringWithFormat:@" %@ ", OOCredits(price)];
9541 if ([eqKeyForSelectFacing isEqualToString:eqKey])
9544 while (facing_count < 5)
9546 NSUInteger multiplier = 1;
9547 switch (facing_count)
9558 multiplier = [forwardWeaponOffset count];
9568 multiplier = [aftWeaponOffset count];
9578 multiplier = [portWeaponOffset count];
9588 multiplier = [starboardWeaponOffset count];
9604 priceString = [
NSString stringWithFormat:@" %@ ", OOCredits(price*multiplier)];
9607 [
gui setArray:[
NSArray arrayWithObjects:desc, (facing_count > 0 ? priceString : (NSString *)@""), timeString, nil]
forRow:row];
9618 if (![eqInfo hideValues])
9641 if ([gui selectedRow] != start_row)
9644 if (eqKeyForSelectFacing !=
nil)
9656 [
gui setText:DESC(@"equip-no-equipment-available-for-purchase")
forRow:GUI_ROW_NO_SHIPS
align:GUI_ALIGN_CENTER];
9670 NSDictionary *background = [UNIVERSE screenTextureDescriptorForKey:@"equip_ship"];
9674 else if (eqKeyForSelectFacing !=
nil)
9676 NSDictionary *bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"mount_weapon"];
9691 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9311- (void) setGuiToEquipShipScreen:(
int)skipParam selectingFacingFor:(NSString *)eqKeyForSelectFacing {
…}
9695- (void) setGuiToEquipShipScreen:(
int)skip
9695- (void) setGuiToEquipShipScreen:(
int)skip {
…}
9707- (void) showInformationForSelectedUpgradeWithFormatString:(NSString *)formatString
9721 if (![eqKey hasPrefix:
@"More:"])
9724 NSString* eq_key_damaged = [
NSString stringWithFormat:@"%@_DAMAGED", eqKey];
9726 if ([
self hasEquipmentItem:eq_key_damaged])
9728 desc = [
NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
9732 if([eqKey hasSuffix:
@"ENERGY_UNIT"] && ([
self hasEquipmentItem:
@"EQ_ENERGY_UNIT_DAMAGED"] || [
self hasEquipmentItem:
@"EQ_ENERGY_UNIT"] || [
self hasEquipmentItem:
@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
9733 desc = [
NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
9734 if (weight > 0) desc = [
NSString stringWithFormat:DESC(@"upgradeinfo-@-weight-d-of-equipment"), desc, weight];
9736 if (formatString) desc = [
NSString stringWithFormat:formatString, desc];
9707- (void) showInformationForSelectedUpgradeWithFormatString:(NSString *)formatString {
…}
9743- (void) setGuiToInterfacesScreen:(
int)skip
9745 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9753 NSArray *interfaceKeys = [
interfaces keysSortedByValueUsingSelector:@selector(interfaceCompare:)];
9761 BOOL guiChanged = (
gui_screen != GUI_SCREEN_INTERFACES);
9769 tab_stops[1] = -480;
9782 if (
count <= n_rows || skip < (NSInteger)n_rows)
9788 previous = skip - (n_rows - 2);
9801 for (i = skip; i < (NSInteger)
count && (row - start_row < (
OOGUIRow)n_rows); i++)
9813 if (i < (NSInteger)
count)
9823 if ([gui selectedRow] != start_row)
9832 [
gui setText:DESC(@"interfaces-no-interfaces-available-for-use")
forRow:GUI_ROW_NO_INTERFACES
align:GUI_ALIGN_LEFT];
9850 NSDictionary *background = [UNIVERSE screenTextureDescriptorForKey:@"interfaces"];
9864 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9743- (void) setGuiToInterfacesScreen:(
int)skip {
…}
9882 if (interfaceKey && ![interfaceKey hasPrefix:
@"More:"])
9900 if ([key hasPrefix:
@"More:"])
9902 int from_item = [[
key componentsSeparatedByString:@":"] oo_intAtIndex:1];
9905 if ([gui selectedRow] < 0)
9919 [[UNIVERSE gameView] clearKeys];
9924 OOLog(
@"interface.missingCallback",
@"Unable to find callback definition for key %@", key);
9932 NSString *text =
nil;
9934 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9940 text =
DESC(
@"game-copyright");
9944 text =
DESC(
@"theme-music-credit");
9948 int initialRow = 22;
9949 int row = initialRow;
9951 text =
DESC(
@"oolite-start-option-1");
9958 text =
DESC(
@"oolite-start-option-2");
9965 text =
DESC(
@"oolite-start-option-3");
9972 text =
DESC(
@"oolite-start-option-4");
9979 text =
DESC(
@"oolite-start-option-5");
9986 text =
DESC(
@"oolite-start-option-6");
10003- (void) setGuiToIntroFirstGo:(BOOL)justCobra
10005 NSString *text =
nil;
10009 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10010 [[UNIVERSE gameView] clearMouse];
10011 [[UNIVERSE gameView] clearKeys];
10016 [UNIVERSE removeDemoShips];
10031 for (i-- ; i >= ms_start ; i--) [gui setColor:[
OOColor redColor] forRow:i];
10037 if ([OXPsWithMessages
count] > 0)
10039 NSString *messageToDisplay =
@"";
10043 if ([OXPsWithMessages
count] < 5)
10045 NSString *messageSourceList = [
OXPsWithMessages componentsJoinedByString:@", "];
10046 messageToDisplay =
OOExpandKey(
@"oxp-containing-messages-list", messageSourceList);
10048 messageToDisplay =
OOExpandKey(
@"oxp-containing-messages-found");
10053 for (i--; i >= ms_start; i--)
10061 NSArray* arguments = [[
NSProcessInfo processInfo] arguments];
10063 for (i = 0; i < [
arguments count]; i++)
10065 if (([[arguments objectAtIndex:i] isEqual:
@"-message"])&&(i < [arguments
count] - 1))
10068 NSString* message = [
arguments oo_stringAtIndex:i + 1];
10070 for (i-- ; i >= ms_start; i--)
10075 if ([[arguments objectAtIndex:i] isEqual:
@"-showversion"])
10078 NSString *version = [
NSString stringWithFormat:@"Version %@", [[[
NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
10080 for (i-- ; i >= ms_start; i--)
10091 text =
DESC(
@"oolite-ship-library-title");
10094 text =
DESC(
@"oolite-ship-library-exit");
10101 [UNIVERSE setupIntroFirstGo: justCobra];
10105 gui_screen = justCobra ? GUI_SCREEN_INTRO1 : GUI_SCREEN_SHIPLIBRARY;
10107 if ([
self status] == STATUS_START_GAME)
10121 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10003- (void) setGuiToIntroFirstGo:(BOOL)justCobra {
…}
10129 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10130 [[UNIVERSE gameView] clearMouse];
10131 [UNIVERSE removeDemoShips];
10135 [[UNIVERSE gui] clearAndKeepBackground:NO];
10140 [[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
10141 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10165 if (fromScreen != toScreen || refresh)
10168 switch (fromScreen)
10170 case GUI_SCREEN_SHIPYARD:
10171 case GUI_SCREEN_LOAD:
10172 case GUI_SCREEN_SAVE:
10182 if (toScreen == GUI_SCREEN_SYSTEM_DATA)
10193 if (![[
UNIVERSE gameController] isGamePaused])
10214 if ([key hasPrefix:
@"More:"])
10216 int from_item = [[
key componentsSeparatedByString:@":"] oo_intAtIndex:1];
10217 NSString *weaponKey = [[
key componentsSeparatedByString:@":"] oo_stringAtIndex:2];
10220 if (weaponKey !=
nil)
10226 if ([gui selectedRow] < 0)
10228 if (from_item == 0)
10251 if ([
self tryBuyingItem:key])
10263 if(
credits != old_credits || ![key hasPrefix:
@"EQ_WEAPON_"])
10267 NSUInteger adjust = 0;
10276 double time_adjust = (old_credits >
credits) ? (old_credits -
credits) : 0.0;
10277 [UNIVERSE forceWitchspaceEntries];
10296 if ([
UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
10309 if (condition_script !=
nil)
10311 OOJSScript *condScript = [UNIVERSE getConditionScript:condition_script];
10312 if (condScript !=
nil)
10319 OK = JS_NewNumberValue(JScontext, price, &args[1]);
10331 OK = JS_ValueToInt32(JScontext, result, &newPrice);
10332 if (OK && newPrice >= 0)
10344- (BOOL) tryBuyingItem:(NSString *)eqKey
10350 double price = pricePerUnit;
10351 double priceFactor = 1.0;
10353 BOOL isRepair = NO;
10356 if ([
self hasEquipmentItem:eqKeyDamaged])
10362 if ([eqKey isEqualToString:
@"EQ_RENOVATION"])
10375 price *= priceFactor;
10377 if (price > credits)
10382 if ([eqType isPrimaryWeapon])
10393 NSUInteger multiplier = 1;
10395 switch (chosen_weapon_facing)
10398 current_weapon = forward_weapon_type;
10399 forward_weapon_type = chosen_weapon;
10400 if (_multiplyWeapons)
10407 current_weapon = aft_weapon_type;
10408 aft_weapon_type = chosen_weapon;
10409 if (_multiplyWeapons)
10416 current_weapon = port_weapon_type;
10417 port_weapon_type = chosen_weapon;
10418 if (_multiplyWeapons)
10425 current_weapon = starboard_weapon_type;
10426 starboard_weapon_type = chosen_weapon;
10427 if (_multiplyWeapons)
10437 price *= multiplier;
10439 if (price > credits)
10444 switch (chosen_weapon_facing)
10447 forward_weapon_type = current_weapon;
10450 aft_weapon_type = current_weapon;
10453 port_weapon_type = current_weapon;
10456 starboard_weapon_type = current_weapon;
10466 if (current_weapon !=
nil)
10468 tradeIn = [UNIVERSE getEquipmentPriceForKey:OOEquipmentIdentifierFromWeaponType(current_weapon)] * multiplier;
10477 if ([eqType isMissileOrMine] && missiles >= max_missiles)
10479 OOLog(
@"equip.buy.mounted.failed.full",
@"%@",
@"rejecting missile because already full");
10487 if ([eqKey isEqualToString:
@"EQ_PASSENGER_BERTH"] && [
self availableCargoSpace] <
PASSENGER_BERTH_SPACE)
10492 if ([eqKey isEqualToString:
@"EQ_FUEL"])
10494#if MASS_DEPENDENT_FUEL_PRICES
10499 if (credits >= creditsForRefuel)
10501 credits -= creditsForRefuel;
10512 if ([eqKey hasSuffix:
@"ENERGY_UNIT"] && [
self energyUnitType] !=
ENERGY_UNIT_NONE)
10514 switch ([
self energyUnitType])
10518 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 2;
10522 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 4;
10526 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 4;
10530 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 8;
10540 if ([eqKey isEqualToString:
@"EQ_RENOVATION"])
10544 if (techLevel == NSNotFound) techLevel = [[UNIVERSE currentSystemData] oo_unsignedIntForKey:KEY_TECHLEVEL];
10547 ship_trade_in_factor += 5 + techLevel;
10548 if (ship_trade_in_factor > 100) ship_trade_in_factor = 100;
10556 if ([eqKey hasSuffix:
@"MISSILE"] || [eqKey hasSuffix:
@"MINE"])
10558 ShipEntity* weapon = [[UNIVERSE newShipWithRole:eqKey] autorelease];
10570 return mounted_okay;
10573 if ([eqKey isEqualToString:
@"EQ_PASSENGER_BERTH"])
10580 if ([eqKey isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"])
10587 if ([eqKey isEqualToString:
@"EQ_MISSILE_REMOVAL"])
10595 if ([
self canAddEquipment:eqKey inContext:
@"purchase"])
10344- (BOOL) tryBuyingItem:(NSString *)eqKey {
…}
10616- (BOOL) setWeaponMount:(
OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context
10623 if (!(available_facings & facing))
10629 if (![eqKey isEqualToString:
@"EQ_WEAPON_NONE"])
10631 if (![
self canAddEquipment:eqKey inContext:context])
10616- (BOOL) setWeaponMount:(
OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context {
…}
10666- (BOOL) changePassengerBerths:(
int) addRemove
10668 if (addRemove == 0)
return NO;
10669 addRemove = (addRemove > 0) ? 1 : -1;
10666- (BOOL) changePassengerBerths:(
int) addRemove {
…}
10689 if (weapon_key !=
nil)
10690 tradeIn += (
int)[
UNIVERSE getEquipmentPriceForKey:weapon_key];
10706 if (tradeInValue != 0)
10708 if (priceFactor < 1.0) tradeInValue *= priceFactor;
10709 credits += tradeInValue;
10718 if ([
self status] != STATUS_DOCKED)
10726 cargoItem = [cargo objectAtIndex:i];
10728 if ([co_type isEqualToString:type])
10746 BOOL inPods = ([
self status] != STATUS_DOCKED);
10749 if (unit ==
UNITS_TONS && (available + oldAmount) < amount)
10751 amount = available + oldAmount;
10759 if (safeAmount < amount) amount = (safeAmount < oldAmount) ? oldAmount : safeAmount;
10761 else if (unit ==
UNITS_GRAMS && amount > oldAmount)
10764 if (safeAmount < amount) amount = (safeAmount < oldAmount) ? oldAmount : safeAmount;
10769 if (amount > oldAmount)
10809 NSString *good =
nil;
10827 cargoQtyOnBoard += quantity;
10829 cargoQtyOnBoard += [[
self cargo] count];
10831 return cargoQtyOnBoard;
10838 if (station ==
nil)
10846 station = [UNIVERSE station];
10848 if (station ==
nil)
10872 foreach (good, goods)
10881 if ([market quantityForGood:good] > 0 || [
self cargoQuantityForType:good] > 0)
10887 if ([
self cargoQuantityForType:good] > 0)
10893 if ([market quantityForGood:good] > 0)
10899 if ([market exportLegalityForGood:good] == 0 && [market importLegalityForGood:good] == 0)
10905 if ([market exportLegalityForGood:good] > 0 || [market importLegalityForGood:good] > 0)
10921 return [
goods sortedArrayUsingFunction:marketSorterByName context:market];
10923 return [
goods sortedArrayUsingFunction:marketSorterByPrice context:market];
10925 return [
goods sortedArrayUsingFunction:marketSorterByQuantity context:market];
10927 return [
goods sortedArrayUsingFunction:marketSorterByQuantity context:shipCommodityData];
10929 return [
goods sortedArrayUsingFunction:marketSorterByMassUnit context:market];
10943 tab_stops[1] = 137;
10944 tab_stops[2] = 187;
10945 tab_stops[3] = 267;
10946 tab_stops[4] = 321;
10947 tab_stops[5] = 431;
10952 [
gui setArray:[
NSArray arrayWithObjects: DESC(@"commodity-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10953 OOPadStringToEms(DESC(@"for-sale-column-title"),3.75), OOPadStringToEms(DESC(@"in-hold-column-title"),5.75), DESC(@"oolite-legality-column-title"), DESC(@"oolite-extras-column-title"), nil]
forRow:GUI_ROW_MARKET_KEY];
10954 [
gui setArray:[
NSArray arrayWithObjects: DESC(@"commodity-column-title"), DESC(@"oolite-extras-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10955 OOPadStringToEms(DESC(@"for-sale-column-title"),3.75), OOPadStringToEms(DESC(@"in-hold-column-title"),5.75), DESC(@"oolite-legality-column-title"), nil]
forRow:GUI_ROW_MARKET_KEY];
10969 NSString *available =
OOPadStringToEms(((available_units > 0) ? (NSString *)[NSString stringWithFormat:
@"%d",available_units] :
DESC(
@"commodity-quantity-none")), 2.5);
10971 NSUInteger priceDecimal = pricePerUnit % 10;
10972 NSString *price = [
NSString stringWithFormat:@" %@.%lu ",OOPadStringToEms([
NSString stringWithFormat:@"%lu",(unsigned long)(pricePerUnit/10)],2.5),priceDecimal];
10976 NSString *owned =
OOPadStringToEms((units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:
@"%d",units_in_hold] :
DESC(
@"commodity-quantity-none"), 4.5);
10978 NSString *units_available = [
NSString stringWithFormat:@" %@ %@ ",available, units];
10979 NSString *units_owned = [
NSString stringWithFormat:@" %@ %@ ",owned, units];
10983 NSString *legaldesc =
nil;
10984 if (import_legality == 0)
10986 if (export_legality == 0)
10988 legaldesc =
DESC(
@"oolite-legality-clear");
10992 legaldesc =
DESC(
@"oolite-legality-import");
10997 if (export_legality == 0)
10999 legaldesc =
DESC(
@"oolite-legality-export");
11003 legaldesc =
DESC(
@"oolite-legality-neither");
11006 legaldesc = [
NSString stringWithFormat:@" %@ ",legaldesc];
11012 [
gui setArray:[
NSArray arrayWithObjects: desc, extradesc, price, units_available, units_owned, legaldesc, nil]
forRow:row++];
11030 NSString *system =
nil;
11031 if ([
UNIVERSE sun] !=
nil) system = [UNIVERSE getSystemName:system_id];
11037 return OOExpandKey(
@"system-commodity-market", system);
11048 return OOExpandKey(
@"station-commodity-market", station);
11060 BOOL guiChanged = (oldScreen !=
gui_screen);
11063 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11068 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11073 NSInteger maxOffset = 0;
11082 for (NSUInteger i = 0; i < commodityCount; i++)
11086 for (NSUInteger i = 0; i < [cargo count]; i++)
11088 ShipEntity *container = [cargo objectAtIndex:i];
11091 if (goodsIndex != NSNotFound)
11106 if ([goods
count] > 0)
11113 NSInteger goodsIndex = [
goods indexOfObject:marketSelectedCommodity];
11118 if (goodsIndex == 0) {
11164 if ([goods
count] > 0)
11168 foreach (good, goods)
11196 [
gui setArray:[
NSArray arrayWithObjects:DESC(@"gui-more"), @"", @"", @"", @" --> ", nil]
forRow:GUI_ROW_MARKET_LAST];
11206 [
gui setArray:[
NSArray arrayWithObjects:DESC(@"gui-back"), @"", @"", @"", @" <-- ", nil]
forRow:GUI_ROW_MARKET_START];
11213 [
gui setText:DESC(@"oolite-market-filtered-all")
forRow:GUI_ROW_MARKET_START];
11224 NSString *filterText =
OOExpandKey(
@"oolite-market-filter-line", filterMode);
11226 NSString *sorterText =
OOExpandKey(
@"oolite-market-sorter-line", sortMode);
11240 [[UNIVERSE gameView] clearMouse];
11243 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11261 BOOL guiChanged = (oldScreen !=
gui_screen);
11264 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11269 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11278 for (i = 0; i < commodityCount; i++)
11282 for (i = 0; i < [cargo count]; i++)
11284 ShipEntity *container = [cargo objectAtIndex:i];
11298 j = [
goods indexOfObject:marketSelectedCommodity];
11300 if (j == NSNotFound)
11315 if (contracted > 0)
11319 [
gui setText:[
NSString stringWithFormat:DESC(@"oolite-commodity-contracted-d-@"), contracted, DisplayStringForMassUnit(unit)]
forRow:GUI_ROW_MARKET_START+1];
11324 if (info ==
nil || [info length] == 0)
11341 [[UNIVERSE gameView] clearMouse];
11344 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11359 [
gui setText:OOExpandKey(@"market-cash-and-load", credits, currentCargo, cargoCapacity)
forRow:GUI_ROW_MARKET_CASH];
11371 if ([index isEqualToString:
@"<<<"] || [index isEqualToString:
@">>>"])
11395 if (manifest_quantity >= contracted)
11401 purchase = contracted-manifest_quantity;
11404 if (purchase > market_quantity)
11406 purchase = market_quantity;
11408 if (purchase * pricePerUnit >
credits)
11410 purchase = floor (
credits / pricePerUnit);
11449 credits -= pricePerUnit * purchase;
11453 if ([
UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11456 if ([
localMarket exportLegalityForGood:index] > 0)
11458 [roleWeightFlags setObject:[
NSNumber numberWithInt:1] forKey:@"bought-illegal"];
11462 [roleWeightFlags setObject:[
NSNumber numberWithInt:1] forKey:@"bought-legal"];
11471 if ([index isEqualToString:
@"<<<"] || [index isEqualToString:
@">>>"])
11483 if (available_units == 0)
return NO;
11493 if (available_units <= contracted)
11499 sell = available_units-contracted;
11503 if (sell > available_units)
11504 sell = available_units;
11505 if (sell + market_quantity > capacity)
11506 sell = capacity - market_quantity;
11512 credits += pricePerUnit * sell;
11516 if ([
UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11536- (BOOL) canAddEquipment:(NSString *)equipmentKey inContext:(NSString *)context
11539 if (![super canAddEquipment:equipmentKey inContext:context])
return NO;
11542 if (conditions !=
nil && ![
self scriptTestConditions:conditions])
return NO;
11536- (BOOL) canAddEquipment:(NSString *)equipmentKey inContext:(NSString *)context {
…}
11548- (BOOL) addEquipmentItem:(NSString *)equipmentKey inContext:(NSString *)context
11548- (BOOL) addEquipmentItem:(NSString *)equipmentKey inContext:(NSString *)context {
…}
11554- (BOOL) addEquipmentItem:(NSString *)equipmentKey withValidation:(BOOL)validateAddition inContext:(NSString *)context
11557 if ([equipmentKey isEqualToString:
@"EQ_TRUMBLE"])
11568 [
self addTrumble:trumble[ranrot_rand() % PLAYER_MAX_TRUMBLES]];
11578 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_COMPASS"] && [
self compassMode] == COMPASS_MODE_BASIC)
11554- (BOOL) addEquipmentItem:(NSString *)equipmentKey withValidation:(BOOL)validateAddition inContext:(NSString *)context {
…}
11596- (void) addEquipmentWithScriptToCustomKeyArray:(NSString *)equipmentKey
11598 NSDictionary *item;
11602 for (i = 0; i < [eqScripts count]; i++)
11604 if ([[[
eqScripts oo_arrayAtIndex:i] oo_stringAtIndex:0] isEqualToString:equipmentKey])
11607 for (j = 0; j < [customEquipActivation count]; j++) {
11608 item = [customEquipActivation objectAtIndex:j];
11614 NSMutableDictionary *customKey = [[
NSMutableDictionary alloc] initWithObjectsAndKeys:equipmentKey, CUSTOMEQUIP_EQUIPKEY, [
eq name], CUSTOMEQUIP_EQUIPNAME, nil];
11619 if ((
object !=
nil && [
object count] > 0))
11620 [
customKey setObject:object forKey:CUSTOMEQUIP_KEYACTIVATE];
11623 if ((
object !=
nil && [
object count] > 0))
11624 [
customKey setObject:object forKey:CUSTOMEQUIP_KEYMODE];
11626 [customEquipActivation addObject:customKey];
11629 [customActivatePressed addObject:[
NSNumber numberWithBool:NO]];
11630 [customModePressed addObject:[
NSNumber numberWithBool:NO]];
11632 NSUserDefaults *defaults = [
NSUserDefaults standardUserDefaults];
11633 [
defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11596- (void) addEquipmentWithScriptToCustomKeyArray:(NSString *)equipmentKey {
…}
11644 NSString *equipmentKey;
11647 equipmentKey = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
11650 [customEquipActivation removeObjectAtIndex:i];
11651 [customActivatePressed removeObjectAtIndex:i];
11652 [customModePressed removeObjectAtIndex:i];
11657 NSUserDefaults *defaults = [
NSUserDefaults standardUserDefaults];
11658 [
defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11663- (void) removeEquipmentItem:(NSString *)equipmentKey
11665 if(![
self hasEquipmentItemProviding:
@"EQ_ADVANCED_COMPASS"] && [
self compassMode] != COMPASS_MODE_BASIC)
11670 if(![
self hasEquipmentItem:equipmentKey]) {
11663- (void) removeEquipmentItem:(NSString *)equipmentKey {
…}
11677- (void) addEquipmentFromCollection:(
id)equipment
11679 NSDictionary *dict =
nil;
11680 NSEnumerator *eqEnum =
nil;
11681 NSString *eqDesc =
nil;
11682 NSUInteger i,
count;
11685 if ([equipment isKindOfClass:[NSDictionary
class]])
11690 else if ([equipment isKindOfClass:[NSArray
class]] || [equipment isKindOfClass:[NSSet
class]])
11694 else if ([equipment isKindOfClass:[NSString
class]])
11696 eqEnum = [[
NSArray arrayWithObject:equipment] objectEnumerator];
11703 while ((eqDesc = [eqEnum nextObject]))
11718 if ([eqDesc isEqualToString:
@"EQ_TRUMBLE"])
continue;
11721 if (dict !=
nil && ![dict oo_boolForKey:eqDesc])
continue;
11728 count = [
dict oo_unsignedIntegerForKey:eqDesc];
11729 for (i=0;i<
count;i++)
11736 if ([equipment isKindOfClass:[NSDictionary
class]])
11740 else if ([equipment isKindOfClass:[NSArray
class]] || [equipment isKindOfClass:[NSSet
class]])
11744 else if ([equipment isKindOfClass:[NSString
class]])
11746 eqEnum = [[
NSArray arrayWithObject:equipment] objectEnumerator];
11749 while ((eqDesc = [eqEnum nextObject]))
11751 if (![
self equipmentValidToAdd:eqDesc whileLoading:YES inContext:
@"loading"])
11677- (void) addEquipmentFromCollection:(
id)equipment {
…}
11759- (BOOL) hasOneEquipmentItem:(NSString *)itemKey includeMissiles:(BOOL)includeMissiles
11762 if ([super hasOneEquipmentItem:itemKey includeMissiles:NO whileLoading:NO])
return YES;
11765 if (includeMissiles)
11770 if ([[
self missileForPylon:i] hasPrimaryRole:itemKey])
return YES;
11774 if ([itemKey isEqualToString:
@"EQ_TRUMBLE"])
11759- (BOOL) hasOneEquipmentItem:(NSString *)itemKey includeMissiles:(BOOL)includeMissiles {
…}
11786 [[
aft_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11787 [[
port_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11805 if ([[
self missileForPylon:i] hasPrimaryRole:identifier])
11817- (BOOL) removeFromPylon:(NSUInteger)pylon
11817- (BOOL) removeFromPylon:(NSUInteger)pylon {
…}
11851 return [parcels count];
11857 return [passengers count];
11874- (void) receiveCommsMessage:(NSString *) message_text from:(
ShipEntity *) other
11876 if ([
self status] == STATUS_DEAD || [
self status] == STATUS_DOCKED)
11881 [UNIVERSE addCommsMessage:[
NSString stringWithFormat:@"%@:\n %@", [
other displayName], message_text] forCount:4.5];
11874- (void) receiveCommsMessage:(NSString *) message_text from:(
ShipEntity *) other {
…}
11890 OOGovernmentID local_gov = [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
11891 if ([
UNIVERSE inInterstellarSpace]) local_gov = 1;
11907 NSString *fined_message = [
NSString stringWithFormat:OOExpandKey(@"fined-@-credits"), OOCredits(fine)];
11909 [UNIVERSE forceWitchspaceEntries];
11914- (void) adjustTradeInFactorBy:(
int)value
11914- (void) adjustTradeInFactorBy:(
int)value {
…}
11944 return [
shipyardInfo oo_doubleForKey:KEY_RENOVATION_MULTIPLIER defaultValue:1.0];
11965 [_customViews release];
11968 if (customViews !=
nil)
11998 NSMutableString *trumbleDigrams = [
NSMutableString stringWithCapacity:256];
11999 unichar xchar = (unichar)0;
12000 unichar digramchars[2];
12017 digramchars[0] = ([
trumbleDigrams characterAtIndex:i] & 0x007f) | 0x0020;
12018 digramchars[1] = (([
trumbleDigrams characterAtIndex:i + 1] ^ xchar) & 0x007f) | 0x0020;
12019 xchar = digramchars[0];
12020 NSString *digramstring = [
NSString stringWithCharacters:digramchars length:2];
12049 NSUInteger trumble_index = NSNotFound;
12052 for (i = 0; (trumble_index == NSNotFound)&&(i <
trumbleCount); i++)
12054 if (
trumble[i] == deadTrumble)
12057 if (trumble_index == NSNotFound)
12059 OOLog(
@"trumble.zombie",
@"DEBUG can't get rid of inactive trumble %@", deadTrumble);
12064 trumble[trumbleCount] = deadTrumble;
12091 [[
NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12100 return [
NSArray arrayWithObjects:[
NSNumber numberWithUnsignedInteger:trumbleCount], [
NSNumber numberWithInt:trumbleHash], trumbleArray, nil];
12104- (void) setTrumbleValueFrom:(NSObject*) trumbleValue
12106 BOOL info_failed = NO;
12108 int putativeHash = 0;
12109 int putativeNTrumbles = 0;
12110 NSArray *putativeTrumbleArray =
nil;
12118 BOOL possible_cheat = NO;
12124 if ([values
count] >= 1)
12125 putativeNTrumbles = [
values oo_intAtIndex:0];
12126 if ([values
count] >= 2)
12127 putativeHash = [
values oo_intAtIndex:1];
12128 if ([values
count] >= 3)
12129 putativeTrumbleArray = [
values oo_arrayAtIndex:2];
12138 if (putativeHash != trumbleHash)
12143 OOLog(
@"cheat.tentative",
@"%@",
@"POSSIBLE CHEAT DETECTED");
12144 possible_cheat = YES;
12155 if (putativeHash == trumbleHash)
12158 putativeNTrumbles = i;
12162 if (possible_cheat && !info_failed)
12163 OOLog(
@"cheat.verified",
@"%@",
@"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12169 OOLog(
@"cheat.tentative",
@"%@",
@"POSSIBLE CHEAT DETECTED");
12173 if (info_failed && [[NSUserDefaults standardUserDefaults] objectForKey:namekey])
12176 putativeHash = (
int)[[NSUserDefaults standardUserDefaults] integerForKey:namekey];
12184 if (putativeHash == trumbleHash)
12187 putativeNTrumbles = i;
12192 OOLog(
@"cheat.verified",
@"%@",
@"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12209 [[
NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12104- (void) setTrumbleValueFrom:(NSObject*) trumbleValue {
…}
12219- (void) setTrumbleAppetiteAccumulator:(
float)value
12219- (void) setTrumbleAppetiteAccumulator:(
float)value {
…}
12225- (void) mungChecksumWithNSString:(NSString *)str
12227 if (str ==
nil)
return;
12229 NSUInteger i, length = [
str length];
12230 for (i = 0; i < length; i++)
12225- (void) mungChecksumWithNSString:(NSString *)str {
…}
12237- (NSString *) screenModeStringForWidth:(
unsigned)width height:(
unsigned)height refreshRate:(
float)refreshRate
12239 if (0.0f != refreshRate)
12241 return OOExpandKey(
@"gameoptions-fullscreen-with-refresh-rate", width, height, refreshRate);
12245 return OOExpandKey(
@"gameoptions-fullscreen", width, height);
12237- (NSString *) screenModeStringForWidth:(
unsigned)width height:(
unsigned)height refreshRate:(
float)refreshRate {
…}
12267 if ([
self status] == STATUS_ESCAPE_SEQUENCE)
12279 if ([
self status] != STATUS_IN_FLIGHT && [
self status] != STATUS_WITCHSPACE_COUNTDOWN)
return;
12280 if (targetEntity ==
self)
return;
12286 assert ([
self hasEquipmentItemProviding:
@"EQ_WORMHOLE_SCANNER"]);
12290 else if ([
self hasEquipmentItemProviding:
@"EQ_TARGET_MEMORY"] && targetEntity !=
nil)
12293 NSUInteger i = [target_memory indexOfObject:targetRef];
12295 if (i != NSNotFound)
12301 i = [target_memory indexOfObject:[
NSNull null]];
12303 if (i != NSNotFound)
12305 [target_memory replaceObjectAtIndex:i withObject:targetRef];
12312 [target_memory replaceObjectAtIndex:target_memory_index withObject:targetRef];
12343 NSUInteger memoryCount = [target_memory count];
12346 if (i < memoryCount)
12348 [target_memory replaceObjectAtIndex:i withObject:[
NSNull null]];
12352 [target_memory addObject:[
NSNull null]];
12364- (BOOL) moveTargetMemoryBy:(NSInteger)delta
12374 id targ_id = [target_memory objectAtIndex:target_memory_index];
12375 if ([targ_id isProxy])
12379 if ((potential_target)&&(potential_target->
isShip)&&([potential_target
isInSpace]))
12410 [target_memory replaceObjectAtIndex:target_memory_index withObject:[
NSNull null]];
12364- (BOOL) moveTargetMemoryBy:(NSInteger)delta {
…}
12420- (void) printIdentLockedOnForMissile:(BOOL)missile
12424 NSString *fmt = missile ?
@"missile-locked-onto-target" :
@"ident-locked-onto-target";
12425 NSString *target = [[
self primaryTarget] identFromShip:
self];
12426 [UNIVERSE addMessage:OOExpandKey(fmt, target) forCount:4.5];
12420- (void) printIdentLockedOnForMissile:(BOOL)missile {
…}
12436- (void) setCustomViewQuaternion:(Quaternion)q
12436- (void) setCustomViewQuaternion:(Quaternion)q {
…}
12455- (void) setCustomViewOffset:(Vector) offset
12455- (void) setCustomViewOffset:(Vector) offset {
…}
12467- (void) setCustomViewRotationCenter:(Vector) center
12467- (void) setCustomViewRotationCenter:(Vector) center {
…}
12644- (void) setCustomViewDataFromDictionary:(NSDictionary *)viewDict withScaling:(BOOL)withScaling
12648 if (viewDict ==
nil)
return;
12666 NSString *facing = [[
viewDict oo_stringForKey:@"weapon_facing"] lowercaseString];
12667 if ([facing isEqual:
@"aft"])
12671 else if ([facing isEqual:
@"port"])
12675 else if ([facing isEqual:
@"starboard"])
12679 else if ([facing isEqual:
@"forward"])
12644- (void) setCustomViewDataFromDictionary:(NSDictionary *)viewDict withScaling:(BOOL)withScaling {
…}
12707 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_no_title"];
12711 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_with_title"];
12719- (void) setMissionOverlayDescriptor:(NSDictionary *)descriptor
12723 [_missionOverlayDescriptor autorelease];
12719- (void) setMissionOverlayDescriptor:(NSDictionary *)descriptor {
…}
12740 result = [UNIVERSE screenTextureDescriptorForKey:@"mission"];
12747- (void) setMissionBackgroundDescriptor:(NSDictionary *)descriptor
12751 [_missionBackgroundDescriptor autorelease];
12747- (void) setMissionBackgroundDescriptor:(NSDictionary *)descriptor {
…}
12763- (void) setMissionBackgroundSpecial:(NSString *)special
12765 if (special ==
nil) {
12768 else if ([special isEqualToString:
@"SHORT_RANGE_CHART"])
12772 else if ([special isEqualToString:
@"SHORT_RANGE_CHART_SHORTEST"])
12774 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12783 else if ([special isEqualToString:
@"SHORT_RANGE_CHART_QUICKEST"])
12785 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12794 else if ([special isEqualToString:
@"CUSTOM_CHART"])
12798 else if ([special isEqualToString:
@"CUSTOM_CHART_SHORTEST"])
12800 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12809 else if ([special isEqualToString:
@"CUSTOM_CHART_QUICKEST"])
12811 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12820 else if ([special isEqualToString:
@"LONG_RANGE_CHART"])
12824 else if ([special isEqualToString:
@"LONG_RANGE_CHART_SHORTEST"])
12826 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12835 else if ([special isEqualToString:
@"LONG_RANGE_CHART_QUICKEST"])
12837 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12763- (void) setMissionBackgroundSpecial:(NSString *)special {
…}
12871- (void) setEquipScreenBackgroundDescriptor:(NSDictionary *)descriptor
12875 [_equipScreenBackgroundDescriptor autorelease];
12871- (void) setEquipScreenBackgroundDescriptor:(NSDictionary *)descriptor {
…}
12889 return [worldScripts allKeys];
12895 return [[worldScripts copy] autorelease];
12901 if (scriptName ==
nil)
12911 if (cscript !=
nil)
12914 [commodityScripts setObject:cscript forKey:scriptName];
12918 OOLog(
@"script.commodityScript.load",
@"Could not load script %@",scriptName);
12924- (void) doScriptEvent:(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc
12924- (void) doScriptEvent:(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc {
…}
12931- (BOOL) doWorldEventUntilMissionScreen:(jsid)message
12933 NSEnumerator *scriptEnum = [worldScripts objectEnumerator];
12940 [[UNIVERSE messageGUI] clear];
12945 while ((theScript = [scriptEnum nextObject]) &&
gui_screen != GUI_SCREEN_MISSION && [
self isDocked])
12954 [[UNIVERSE messageGUI] clear];
12931- (BOOL) doWorldEventUntilMissionScreen:(jsid)message {
…}
12962- (void) doWorldScriptEvent:(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc timeLimit:(
OOTimeDelta)limit
12966 NSEnumerator *scriptEnum =
nil;
12962- (void) doWorldScriptEvent:(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc timeLimit:(
OOTimeDelta)limit {
…}
12993- (void) setGalacticHyperspaceFixedCoords:(NSPoint)point
12993- (void) setGalacticHyperspaceFixedCoords:(NSPoint)point {
…}
12999- (void) setGalacticHyperspaceFixedCoordsX:(
unsigned char)x y:(
unsigned char)y
12999- (void) setGalacticHyperspaceFixedCoordsX:(
unsigned char)x y:(
unsigned char)y {
…}
13012- (void) setWitchspaceCountdown:(
int)spin_time
13012- (void) setWitchspaceCountdown:(
int)spin_time {
…}
13035- (void) setScoopOverride:(BOOL)newValue
13035- (void) setScoopOverride:(BOOL)newValue {
…}
13042#if MASS_DEPENDENT_FUEL_PRICES
13045 GLfloat rate = 1.0;
13050 if (
EXPECT(ship_trade_in_factor <= 90 && ship_trade_in_factor >= 75))
13075- (void) setJumpCause:(NSString *)value
13077 NSParameterAssert(value !=
nil);
13078 [_jumpCause autorelease];
13075- (void) setJumpCause:(NSString *)value {
…}
13095- (void) setCommanderName:(NSString *)value
13097 NSParameterAssert(value !=
nil);
13098 [_commanderName autorelease];
13095- (void) setCommanderName:(NSString *)value {
…}
13103- (void) setLastsaveName:(NSString *)value
13105 NSParameterAssert(value !=
nil);
13106 [_lastsaveName autorelease];
13103- (void) setLastsaveName:(NSString *)value {
…}
13113 BOOL isDockedStatus = NO;
13117 case STATUS_DOCKED:
13118 case STATUS_DOCKING:
13119 case STATUS_START_GAME:
13120 isDockedStatus = YES;
13123 case STATUS_RESTART_GAME:
13125 case STATUS_EFFECT:
13126 case STATUS_ACTIVE:
13127 case STATUS_COCKPIT_DISPLAY:
13129 case STATUS_INACTIVE:
13131 case STATUS_IN_FLIGHT:
13132 case STATUS_AUTOPILOT_ENGAGED:
13133 case STATUS_LAUNCHING:
13134 case STATUS_WITCHSPACE_COUNTDOWN:
13135 case STATUS_ENTERING_WITCHSPACE:
13136 case STATUS_EXITING_WITCHSPACE:
13137 case STATUS_ESCAPE_SEQUENCE:
13138 case STATUS_IN_HOLD:
13139 case STATUS_BEING_SCOOPED:
13140 case STATUS_HANDLING_ERROR:
13147 if (isDockedStatus)
13154 isDockedStatus = NO;
13163 isDockedStatus = YES;
13168 return isDockedStatus;
13215 amountToPay =
MIN(maximumFine, calculatedFine);
13217 [
self addMessageToReport:[
NSString stringWithFormat:DESC(@"station-docking-clearance-fined-@-cr"), OOCredits(amountToPay)]];
13227 assert(whole !=
nil);
13230 NSEnumerator *wormholes = [scannedWormholes objectEnumerator];
13232 while ((wh = [wormholes nextObject]))
13234 if (wh == whole)
return;
13237 [scannedWormholes addObject:whole];
13245 assert(scannedWormholes !=
nil);
13247 if ([scannedWormholes
count] == 0)
13260 if ([wh arrivalTime] > now)
13264 else if (NSEqualPoints(galaxy_coordinates, [wh destinationCoordinates]))
13267 if ([[wh shipsInTransit]
count] > 0)
13276 scannedWormholes = savedWormholes;
13282 return [
NSArray arrayWithArray:scannedWormholes];
13286- (void) initialiseMissionDestinations:(NSDictionary *)destinations andLegacy:(NSArray *)legacy
13288 NSEnumerator *keyEnum =
nil;
13289 NSString *key =
nil;
13294 [missionDestinations release];
13297 for (keyEnum = [destinations keyEnumerator]; (key = [
keyEnum nextObject]); )
13302 if ([value isKindOfClass:[NSDictionary
class]])
13304 value = [
value mutableCopy];
13305 [missionDestinations setObject:value forKey:key];
13314 NSNumber *legacyMarker;
13315 for (keyEnum = [legacy objectEnumerator]; (legacyMarker = [
keyEnum nextObject]); )
13286- (void) initialiseMissionDestinations:(NSDictionary *)destinations andLegacy:(NSArray *)legacy {
…}
13325- (NSString *)markerKey:(NSDictionary *)marker
13327 return [
NSString stringWithFormat:@"%d-%@",[
marker oo_intForKey:@"system"], [
marker oo_stringForKey:@"name"]];
13325- (NSString *)markerKey:(NSDictionary *)marker {
…}
13331- (void) addMissionDestinationMarker:(NSDictionary *)marker
13334 if (validated ==
nil)
13339 [missionDestinations setObject:validated forKey:[
self markerKey:validated]];
13331- (void) addMissionDestinationMarker:(NSDictionary *)marker {
…}
13343- (BOOL) removeMissionDestinationMarker:(NSDictionary *)marker
13346 if (validated ==
nil)
13354 [missionDestinations removeObjectForKey:[
self markerKey:validated]];
13343- (BOOL) removeMissionDestinationMarker:(NSDictionary *)marker {
…}
13371- (void) setLastShot:(NSArray *)shot
13371- (void) setLastShot:(NSArray *)shot {
…}
13379 [extraMissionKeys release];
13384- (void) setExtraMissionKeys:(NSDictionary *)keys
13386 NSString *key =
nil;
13388 foreach (key, [keys allKeys])
13384- (void) setExtraMissionKeys:(NSDictionary *)keys {
…}
13399 NSMutableArray *keydefs = [extraGuiScreenKeys objectForKey:[
NSString stringWithFormat:@"%d",gui]];
13400 NSInteger i = [
keydefs count];
13401 NSDictionary *def =
nil;
13404 def = [
keydefs objectAtIndex:i];
13405 if (def && [[def oo_stringForKey:
@"name"] isEqualToString:key])
13407 [
keydefs removeObjectAtIndex:i];
13419 NSMutableArray *newarray =
nil;
13420 NSString *key =
nil;
13422 NSDictionary *keys = [
definition registerKeys];
13425 foreach (key, [keys allKeys])
13429 [
final setObject:item forKey:key];
13447 newarray = [[extraGuiScreenKeys objectForKey:[
NSString stringWithFormat:@"%d",gui]] mutableCopy];
13453 def_existing = [
newarray objectAtIndex:i];
13455 if (def_existing && [[def_existing
name] isEqualToString:[definition
name]])
13464 foreach (key, [keydefs allKeys])
13469 if ([[NSString stringWithFormat:
@"%@",[keydefs objectForKey:key]] isEqualToString:[NSString stringWithFormat:
@"%@",[checklist objectAtIndex:j]]])
13472 OOLog(
kOOLogException,
@"***** Exception in setExtraGuiScreenKeys: %@ : %@ (%@)",
@"invalid key settings",
@"key already in use", key);
13481 if (result) [extraGuiScreenKeys setObject:[
newarray mutableCopy] forKey:[
NSString stringWithFormat:@"%d",gui]];
13490 NSMutableArray *flags =
nil;
13491 NSString *flagsString =
nil;
13507 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
13536 flagsString = [
flags count] ? [
flags componentsJoinedByString:@", "] : (NSString *)
@"none";
13537 OOLog(
@"dumpState.playerEntity",
@"Flags: %@", flagsString);
13663#if OO_FOV_INFLIGHT_CONTROL_ENABLED
13664 n_key_inc_field_of_view &&
13665 n_key_dec_field_of_view &&
13707 return NSOrderedAscending;
13709 else if (result > 0)
13711 return NSOrderedDescending;
13715 return NSOrderedSame;
13726 return NSOrderedAscending;
13728 else if (result > 0)
13730 return NSOrderedDescending;
13734 return NSOrderedSame;
13745 return NSOrderedAscending;
13747 else if (result > 0)
13749 return NSOrderedDescending;
13753 return NSOrderedSame;
BOOL shadowAtPointOcclusionToValue(HPVector e1pos, GLfloat e1rad, Entity *e2, OOSunEntity *the_sun, float *outValue)
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
#define SCANNER_MAX_RANGE
#define SCANNER_MAX_RANGE2
#define ADD_FLAG_IF_SET(x)
#define MINIMUM_GAME_TICK
@ GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_SHORT_ANA_SHORTEST
@ GUI_BACKGROUND_SPECIAL_LONG
@ GUI_BACKGROUND_SPECIAL_LONG_ANA_SHORTEST
@ GUI_BACKGROUND_SPECIAL_SHORT
@ GUI_BACKGROUND_SPECIAL_NONE
@ GUI_BACKGROUND_SPECIAL_SHORT_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_LONG_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_CUSTOM
@ GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_SHORTEST
OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS]
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOINLINE jsval OOJSValueFromCompassMode(JSContext *context, OOCompassMode value)
OOINLINE jsval OOJSValueFromGUIScreenID(JSContext *context, OOGUIScreenID value)
NSString * EnergyUnitTypeToString(OOEnergyUnitType unit) CONST_FUNC
NSString * DisplayStringForMassUnit(OOMassUnit unit)
NSString * OOStringFromLegalStatusReason(OOLegalStatusReason reason)
const HPVector kZeroHPVector
#define OOJSStopTimeLimiter()
#define kOOJSLongTimeLimit
#define OOJSStartTimeLimiterWithTimeLimit(limit)
#define JS_IsInRequest(context)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
#define OOLogWARN(class, format,...)
#define OOLogERR(class, format,...)
NSString *const kOOLogException
NSString *const kOOLogInconsistentState
#define OOLog(class, format,...)
const OOMatrix kIdentityMatrix
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Vector vector_up_from_quaternion(Quaternion quat)
void quaternion_rotate_about_x(Quaternion *quat, OOScalar angle)
HPVector HPvector_forward_from_quaternion(Quaternion quat)
Vector vector_right_from_quaternion(Quaternion quat)
Vector vector_forward_from_quaternion(Quaternion quat)
void quaternion_rotate_about_z(Quaternion *quat, OOScalar angle)
void quaternion_set_random(Quaternion *quat)
Vector quaternion_rotate_vector(Quaternion q, Vector v)
const Quaternion kIdentityQuaternion
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)
const Quaternion kZeroQuaternion
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
#define OOExpandKey(key,...)
#define OOExpandKeyWithSeed(seed, key,...)
#define OOExpand(string,...)
NSString * ClockToString(double clock, BOOL adjusting)
OOINLINE NSString * OOCredits(OOCreditsQuantity tenthsOfCredits)
NSPoint PointFromString(NSString *xyString)
NSMutableArray * ScanTokensFromString(NSString *values)
NSString * OOPadStringToEms(NSString *string, float numEms)
#define OO_GALAXIES_AVAILABLE
@ OO_SYSTEMCONCEALMENT_NODATA
@ OO_SYSTEMCONCEALMENT_NONAME
#define OO_SYSTEMS_PER_GALAXY
uint8_t OOWeaponFacingSet
NSString * OOCommodityType
@ AEGIS_CLOSE_TO_MAIN_PLANET
uint64_t OOCreditsQuantity
#define VALID_WEAPON_FACINGS
@ DOCKING_CLEARANCE_STATUS_NOT_REQUIRED
@ DOCKING_CLEARANCE_STATUS_GRANTED
@ DOCKING_CLEARANCE_STATUS_NONE
@ DOCKING_CLEARANCE_STATUS_REQUESTED
@ WEAPON_FACING_STARBOARD
@ ENERGY_UNIT_NAVAL_DAMAGED
@ ENERGY_UNIT_NORMAL_DAMAGED
OOCreditsQuantity OODeciCreditsFromObject(id object)
OOGalacticHyperspaceBehaviour
@ GALACTIC_HYPERSPACE_MAX
#define MAX_KILOGRAMS_IN_SAFE
#define PLAYER_STARTING_MISSILES
@ PLAYER_FLEEING_UNLIKELY
@ ALERT_FLAG_YELLOW_LIMIT
#define ESCAPE_SEQUENCE_TIME
#define CUSTOM_VIEW_MAX_ZOOM_IN
@ OOPRIMEDEQUIP_ACTIVATED
#define CHART_WIDTH_AT_MAX_ZOOM
#define PLAYER_MAX_WEAPON_TEMP
#define PORT_FACING_STRING
#define PLAYER_INTERNAL_DAMAGE_FACTOR
@ MARKET_FILTER_MODE_HOLD
@ MARKET_FILTER_MODE_RESTRICTED
@ MARKET_FILTER_MODE_STOCK
@ MARKET_FILTER_MODE_TRADE
@ MARKET_FILTER_MODE_LEGAL
#define MAX_GRAMS_IN_SAFE
#define HYPERSPEED_FACTOR
#define KILOGRAMS_PER_POD
#define PLAYER_DIAL_MAX_ALTITUDE
#define MAX_HYPERSPEED_FACTOR
#define FORWARD_FACING_STRING
#define AFT_FACING_STRING
#define GUI_ROW_INIT(GUI)
@ SCOOP_STATUS_NOT_INSTALLED
#define CHART_HEIGHT_AT_MAX_ZOOM
#define CUSTOM_VIEW_MAX_ZOOM_OUT
#define MIN_HYPERSPEED_FACTOR
#define GUI_ROW(GROUP, ITEM)
@ GUI_ROW_EQUIPMENT_DETAIL
@ GUI_ROW_EQUIPMENT_START
@ GUI_ROW_INTERFACES_START
@ GUI_MAX_ROWS_INTERFACES
#define STARBOARD_FACING_STRING
#define CUSTOMEQUIP_EQUIPKEY
#define CHART_SCROLL_AT_Y
#define SCANNER_ECM_FUZZINESS
#define CHART_SCROLL_AT_X
#define SCRIPT_TIMER_INTERVAL
#define PLAYER_DOCKING_AI_NAME
@ MISSILE_STATUS_TARGET_LOCKED
@ MARKET_SORTER_MODE_PRICE
@ MARKET_SORTER_MODE_STOCK
@ MARKET_SORTER_MODE_ALPHA
@ MARKET_SORTER_MODE_UNIT
@ MARKET_SORTER_MODE_HOLD
#define ECM_ENERGY_DRAIN_FACTOR
NSString * OODisplayStringFromLegalStatus(int legalStatus)
#define GUI_FIRST_ROW(GROUP)
NSString * KillCountToRatingAndKillString(unsigned kills)
#define PLAYER_SHIP_CLOCK_START
#define PLAYER_TARGET_MEMORY_SIZE
#define PLAYER_STARTING_MAX_MISSILES
#define PLAYER_MAX_TRUMBLES
#define PLAYER_MAX_MISSILES
static NSString *const kOOLogBuyMountedOK
static NSString *const kOOLogBuyMountedFailed
#define VELOCITY_CLEANUP_MIN
#define STAGE_TRACKING_END
NSComparisonResult marketSorterByName(id a, id b, void *market)
NSComparisonResult marketSorterByPrice(id a, id b, void *market)
NSComparisonResult marketSorterByQuantity(id a, id b, void *market)
static NSString * last_outfitting_key
static float const kDeadResetTime
#define VELOCITY_CLEANUP_RATE
#define STAGE_TRACKING_BEGIN
NSComparisonResult marketSorterByMassUnit(id a, id b, void *market)
#define VELOCITY_CLEANUP_FULL
#define OO_SETACCESSCONDITIONFORROW(condition, row)
#define SCENARIO_OXP_DEFINITION_NONE
#define SCENARIO_OXP_DEFINITION_ALL
#define MIN_HDR_PAPERWHITE
#define MAX_HDR_PAPERWHITE
#define INITIAL_SHOT_TIME
OOEquipmentType * OOWeaponType
BOOL isWeaponNone(OOWeaponType weapon)
#define SHIP_COOLING_FACTOR
#define CLOAKING_DEVICE_MIN_ENERGY
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string) PURE_FUNC
#define ShipScriptEventNoCx(ship, event,...)
#define ENTITY_PERSONALITY_INVALID
OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy(NSString *string)
#define SHIP_MIN_CABIN_TEMP
#define MILITARY_JAMMER_ENERGY_RATE
#define CLOAKING_DEVICE_ENERGY_RATE
#define WEAPON_COOLING_FACTOR
#define SHIP_MAX_CABIN_TEMP
#define MILITARY_JAMMER_MIN_ENERGY
NSString * OOStringFromShipDamageType(OOShipDamageType type) CONST_FUNC
NSString * OODisplayStringFromAlertCondition(OOAlertCondition alertCondition)
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string) PURE_FUNC
#define BASELINE_SHIELD_LEVEL
#define SHIP_THRUST_FACTOR
#define ShipScriptEvent(context, ship, event,...)
#define WEAPON_COOLING_CUTOUT
#define SHIP_INSULATION_FACTOR
#define SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR
#define PASSENGER_BERTH_SPACE
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
void updateAlertConditionForNearbyEntities()
void showMarketCashAndLoadLine()
void updateMovementFlags()
void setExtraEquipmentFromFlags()
void showMarketScreenHeaders()
OOFuelQuantity fuelRequiredForJump()
void checkScriptsIfAppropriate()
void noteCompassLostTarget()
void updateAlertCondition()
double hyperspaceJumpDistance()
void setGuiToIntroFirstGo:(BOOL justCobra)
void setNextThinkTime:(OOTimeAbsolute ntt)
void setOwner:(ShipEntity *ship)
void setState:(NSString *stateName)
OOUniversalID universalID
HPVector absolutePositionForSubentity()
void setVelocity:(Vector vel)
void setOrientation:(Quaternion quat)
GLfloat collisionRadius()
void setScanClass:(OOScanClass sClass)
GLfloat distanceTravelled
void setPositionX:y:z:(OOHPScalar x,[y] OOHPScalar y,[z] OOHPScalar z)
Quaternion lastOrientation
Vector relativePosition()
void applyVelocity:(OOTimeDelta delta_t)
void setPosition:(HPVector posn)
NSString * playerFileToLoad
GameController * sharedController()
void stopAnimationTimer()
void logProgress:(NSString *message)
void startAnimationTimer()
NSUInteger indexOfCurrentDisplayMode()
BOOL setBackgroundTextureKey:(NSString *key)
OOColor * colorFromSetting:defaultValue:(NSString *setting,[defaultValue] OOColor *def)
BOOL setSelectedRow:(OOGUIRow row)
OOGUIRow addLongText:startingAtRow:align:(NSString *str,[startingAtRow] OOGUIRow row,[align] OOGUIAlignment alignment)
BOOL setForegroundTextureKey:(NSString *key)
void setStatusPage:(NSInteger pageNum)
NSString * selectedRowText()
void setText:forRow:(NSString *str,[forRow] OOGUIRow row)
void setText:forRow:align:(NSString *str,[forRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void clearAndKeepBackground:(BOOL keepBackground)
BOOL setForegroundTextureDescriptor:(NSDictionary *descriptor)
void overrideTabs:from:length:(OOGUITabSettings stops,[from] NSString *setting,[length] NSUInteger len)
NSDictionary * userSettings()
void setSelectableRange:(NSRange range)
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
NSString * selectedRowKey()
void setTitle:(NSString *str)
void setTabStops:(OOGUITabSettings stops)
NSString * keyForRow:(OOGUIRow row)
void setShowTextCursor:(BOOL yesno)
void setCurrentRow:(OOGUIRow value)
BOOL setBackgroundTextureDescriptor:(NSDictionary *descriptor)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
void setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
void setHidden:(BOOL newValue)
void setScannerZoom:(GLfloat value)
void setCompassActive:(BOOL newValue)
void setDeferredHudName:(NSString *newDeferredHudName)
void resetGuis:(NSDictionary *info)
BOOL isRunningOnPrimaryDisplayDevice()
float fov:(BOOL inFraction)
void adjustColorSaturation:(float colorSaturationAdjustment)
void setMouseWheelDelta:(float newWheelDelta)
GameController * gameController
OOCacheManager * sharedCache()
void setObject:forKey:(id value,[forKey] id key)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
OOColor * colorWithDescription:(id description)
OOCommodityType legacyCommodityType:(NSUInteger i)
NSUInteger exportLegalityForGood:(OOCommodityType good)
OOMassUnit massUnitForGood:(OOCommodityType good)
NSArray * savePlayerAmounts()
void loadPlayerAmounts:(NSArray *amounts)
NSUInteger importLegalityForGood:(OOCommodityType good)
BOOL removeQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity capacityForGood:(OOCommodityType good)
BOOL setQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity quantityForGood:(OOCommodityType good)
BOOL addQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCreditsQuantity priceForGood:(OOCommodityType good)
NSString * nameForGood:(OOCommodityType good)
NSString * commentForGood:(OOCommodityType good)
NSString * conditionScript()
NSString * damagedIdentifier()
NSArray * defaultActivateKey()
NSArray * defaultModeKey()
OOTechLevelID effectiveTechLevel()
OOCargoQuantity requiredCargoSpace()
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)
OOCreditsQuantity price()
GLfloat damageProbability()
NSString * descriptiveText()
NSDictionary * registerKeys()
void runCallback:(NSString *key)
BOOL callMethod:inContext:withArguments:count:result:(jsid methodID,[inContext] JSContext *context,[withArguments] jsval *argv,[count] intN argc,[result] jsval *outResult)
OOJavaScriptEngine * sharedEngine()
void garbageCollectionOpportunity:(BOOL force)
void update:(OOTimeDelta delta_t)
OOMusicController * sharedController()
OOOXZManager * sharedManager()
id jsScriptFromFileNamed:properties:(NSString *fileName,[properties] NSDictionary *properties)
BOOL callMethod:inContext:withArguments:count:result:(jsid methodID,[inContext] JSContext *context,[withArguments] jsval *argv,[count] intN argc,[result] jsval *outResult)
NSDictionary * shipyardInfoForKey:(NSString *key)
OOShipRegistry * sharedRegistry()
NSDictionary * shipInfoForKey:(NSString *key)
NSDictionary * dictionary()
void spawnFrom:(OOTrumble *parentTrumble)
void updateTrumble:(double delta_t)
OOWeakReference * weakSelf
id weakRefUnderlyingObject()
OOWeaponFacingSet availableFacings()
BOOL addEquipmentItem:withValidation:inContext:(NSString *equipmentKey, [withValidation] BOOL validateAddition, [inContext] NSString *context)
NSMutableDictionary * roleWeightFlags
OOTimeDelta forward_shot_time
void addRoleToPlayer:(NSString *role)
NSMutableDictionary * passenger_record
NSArray * n_key_activate_equipment
void setGuiToSystemDataScreen()
unsigned mouse_control_on
NSString * dial_fpsinfo()
void updateTrumbles:(OOTimeDelta delta_t)
OOWeaponType currentWeapon()
void setMissionBackgroundDescriptor:(NSDictionary *descriptor)
OOScalar saved_chart_zoom
void normaliseReputation()
NSDictionary * passengerContractMarker:(OOSystemID system)
void doTradeIn:forPriceFactor:(OOCreditsQuantity tradeInValue, [forPriceFactor] double priceFactor)
unsigned launchingMissile
NSDictionary * keyconfig2_settings
void setBounty:withReasonAsString:(OOCreditsQuantity amount, [withReasonAsString] NSString *reason)
void getDestroyedBy:damageType:(Entity *whom, [damageType] OOShipDamageType type)
NSArray * n_key_gui_screen_interfaces
OOSystemID info_system_id
NSArray * n_key_gui_arrow_right
NSArray * n_key_scanner_zoom
void noteGUIDidChangeFrom:to:refresh:(OOGUIScreenID fromScreen,[to] OOGUIScreenID toScreen,[refresh] BOOL refresh)
NSArray * n_key_debug_shaders
unsigned autopilot_engaged
Vector viewpointOffsetAft()
void showShipModelWithKey:shipData:personality:factorX:factorY:factorZ:inContext:(NSString *shipKey,[shipData] NSDictionary *shipData,[personality] uint16_t personality,[factorX] GLfloat factorX,[factorY] GLfloat factorY,[factorZ] GLfloat factorZ,[inContext] NSString *context)
NSDictionary * keyConfig()
NSArray * n_key_next_target
void playWitchjumpFailure()
void playWeaponOverheated:(Vector weaponOffset)
NSArray * n_key_docking_clearance_request
OOEnergyUnitType installedEnergyUnitType()
BOOL hasSufficientFuelForJump()
void setActiveMissile:(NSUInteger value)
void setNextCompassMode()
void setGuiToLongRangeChartScreen()
float _trumbleAppetiteAccumulator
void addTrumble:(OOTrumble *papaTrumble)
NSMutableDictionary * missionDestinations
NSArray * n_key_market_buy_max
void setAlertFlag:to:(int flag,[to] BOOL value)
void setGuiToLoadSaveScreen()
NSString * markerKey:(NSDictionary *marker)
NSArray * n_key_rotate_cargo
NSArray * n_key_custom_view_rotate_left
NSArray * n_key_untarget_missile
ShipEntity * launchEscapeCapsule()
void setGuiToChartScreenFrom:(OOGUIScreenID oldScreen)
NSArray * n_key_gui_screen_status
void activateSelectedInterface()
StickProfileScreen * stickProfileScreen
void setBounty:withReason:(OOCreditsQuantity amount, [withReason] OOLegalStatusReason reason)
void playHostileWarning()
void setGuiToMarketScreen()
void setGuiToGameOptionsScreen()
NSArray * n_key_oxzmanager_extract
OODockingClearanceStatus getDockingClearanceStatus()
GLfloat max_forward_shield
void playTargetSwitched()
NSDictionary * equipScreenBackgroundDescriptor()
void deactivateCloakingDevice()
void setGuiToEquipShipScreen:selectingFacingFor:(int skip,[selectingFacingFor] NSString *eqKeyForSelectFacing)
OOMarketSorterMode marketSorterMode
void playMissileLaunched:weaponIdentifier:(Vector weaponOffset,[weaponIdentifier] NSString *weaponIdentifier)
void unloadAllCargoPodsForType:toManifest:(OOCommodityType type,[toManifest] OOCommodityMarket *manifest)
NSArray * n_key_map_next_system
NSArray * n_key_custom_view_pan_left
OOCargoQuantity current_cargo
NSArray * n_key_info_next_system
void performDeadUpdates:(OOTimeDelta delta_t)
NSString * commanderName()
StationEntity * getTargetDockStation()
BOOL setMultiFunctionDisplay:toKey:(NSUInteger index,[toKey] NSString *key)
Vector starboardViewOffset
GLfloat laserHeatLevelForward()
void setFoundTarget:(Entity *targetEntity)
OOPlayerFleeingStatus fleeing_status
NSArray * n_key_yaw_right
void updateMovementFlags()
NSString * missionTitle()
void setGuiToInterfacesScreen:(int skip)
NSArray * n_key_custom_view_pan_down
unsigned keyboardPitchOverride
NSDictionary * worldScriptsByName()
void playMenuNavigationDown()
OOAlertCondition realAlertCondition()
OOMatrix drawRotationMatrix()
NSMutableArray * contracts
void checkScriptsIfAppropriate()
OODockingClearanceStatus dockingClearanceStatus
void enterGalacticWitchspace()
NSArray * n_key_view_forward
GLfloat forwardShieldLevel()
NSString * _missionScreenID
void setCompassTarget:(Entity *value)
OOGUIScreenID missionExitScreen()
NSMutableDictionary * localVariables
BOOL _missionAllowInterrupt
void performLaunchingUpdates:(OOTimeDelta delta_t)
float trumbleAppetiteAccumulator()
void playHyperspaceNoFuel()
NSInteger missingSubEntitiesAdjustment()
NSArray * n_key_debug_off
void performInFlightUpdates:(OOTimeDelta delta_t)
void showMarketCashAndLoadLine()
BOOL checkEntityForMassLock:withScanClass:(Entity *ent, [withScanClass] int theirClass)
OOCreditsQuantity adjustPriceByScriptForEqKey:withCurrent:(NSString *eqKey,[withCurrent] OOCreditsQuantity price)
NSArray * n_key_galactic_hyperspace
BOOL removeFromPylon:(NSUInteger pylon)
void performWitchspaceExitUpdates:(OOTimeDelta delta_t)
void setMissionBackgroundSpecial:(NSString *special)
NSArray * n_key_autopilot
NSArray * parcelListForScripting()
double renovationFactor()
NSArray * n_key_weapons_online_toggle
OOSystemID previousSystemID()
void setPrevCompassMode()
void setSystemID:(OOSystemID sid)
void addEquipmentWithScriptToCustomKeyArray:(NSString *equipmentKey)
OOWeakReference * _dockedStation
NSArray * n_key_pausebutton
NSString * screenModeStringForWidth:height:refreshRate:(unsigned inWidth,[height] unsigned inHeight,[refreshRate] float inRate)
void setGuiToStatusScreen()
void witchJumpTo:misjump:(OOSystemID sTo, [misjump] BOOL misjump)
Vector weaponViewOffset()
NSMutableDictionary * customDialSettings
NSArray * n_key_dump_target_state
OOWeakReference * compassTarget
unsigned waitingForStickCallback
double scannerFuzziness()
void playScrapeDamage:(Vector attackVector)
NSDictionary * _missionOverlayDescriptor
NSString * _fastEquipmentB
NSArray * n_key_gui_select
void noteCompassLostTarget()
NSArray * n_key_custom_view_zoom_out
NSArray * n_key_custom_view_roll_right
void resetMissionChoice()
NSArray * n_key_dump_entity_list
NSMutableArray * roleSystemList
void setGuiToMarketInfoScreen()
BOOL mountMissile:(ShipEntity *missile)
NSMutableArray * cdrDetailArray
NSArray * n_key_market_buy_one
Vector viewpointOffsetStarboard()
OOLongRangeChartMode longRangeChartMode
NSArray * n_key_roll_right
OOGalaxyID galaxyNumber()
NSDictionary * validatedMarker:(NSDictionary *marker)
NSUInteger passengerCount()
void markAsOffender:withReason:(int offence_value, [withReason] OOLegalStatusReason reason)
NSMutableDictionary * contract_record
unsigned travelling_at_hyperspeed
unsigned replacingMissile
StationEntity * dockedStation()
NSMutableString * dockingReport
void setShowDemoShips:(BOOL value)
NSArray * n_key_cycle_next_mfd
void playWitchjumpInsufficientFuel()
NSString * checkPassengerContracts()
void cancelWitchspaceCountdown()
void playWitchjumpDistanceTooGreat()
NSMutableArray * target_memory
OOMatrix drawTransformationMatrix()
unsigned hyperspeed_engaged
void updateAlertConditionForNearbyEntities()
void updateClocks:(OOTimeDelta delta_t)
OOCreditsQuantity deciCredits()
void penaltyForUnauthorizedDocking()
NSArray * n_key_advanced_nav_array_previous
NSArray * n_key_gui_chart_screens
NSArray * n_key_system_previous_system
Quaternion normalOrientation()
OOSystemID previous_system_id
NSMutableArray * roleWeights
OOGUIScreenID _missionExitScreen
BOOL switchHudTo:(NSString *hudFileName)
GLfloat laserHeatLevelPort()
NSPoint custom_chart_centre_coordinates
NSUInteger dialMaxMissiles()
OOCargoQuantity contractedVolumeForGood:(OOCommodityType good)
BOOL changePassengerBerths:(int addRemove)
NSArray * n_key_gui_arrow_up
void removeEqScriptForKey:(NSString *eq_key)
void pollControls:(double delta_t)
GLfloat laserHeatLevelStarboard()
NSDictionary * commanderDataDictionary()
NSArray * n_key_debug_full
NSArray * n_key_gui_arrow_down
double escapePodRescueTime()
NSArray * n_key_custom_view
OOCreditsQuantity bounty()
void clearExtraMissionKeys()
OOMarketFilterMode marketFilterMode
OOTimeDelta witchspaceCountdown
NSMutableArray * passengers
void playDirectHit:weaponIdentifier:(Vector attackVector,[weaponIdentifier] NSString *weaponIdentifier)
void addScannedWormhole:(WormholeEntity *wormhole)
void setDockingClearanceStatus:(OODockingClearanceStatus newValue)
NSString * commanderNameString
ShipEntity * launchMine:(ShipEntity *mine)
void setFastEquipmentA:(NSString *eqKey)
NSArray * n_key_gui_page_up
OOCreditsQuantity removeMissiles()
NSArray * n_key_prev_compass_mode
NSArray * worldScriptNames()
NSArray * n_key_jumpdrive
NSDictionary * cargoContractMarker:(OOSystemID system)
unsigned afterburnerSoundLooping
unsigned afterburner_engaged
void playCloakingDeviceOn()
NSString * compassTargetLabel()
NSDictionary * extraMissionKeys
NSArray * equipmentList()
void setDockTarget:(ShipEntity *entity)
OOCommodityMarket * shipCommodityData
NSArray * n_key_cycle_previous_mfd
NSMutableDictionary * shipyardRecord()
void stopAfterburnerSound()
NSArray * contractsListForScriptingFromArray:forCargo:(NSArray *contracts_array, [forCargo] BOOL forCargo)
NSArray * n_key_market_sell_max
void setFastEquipmentB:(NSString *eqKey)
NSMutableDictionary * reputation
NSArray * n_key_bloom_toggle
NSPoint galaxy_coordinates
NSArray * n_key_roll_left
NSUInteger eqScriptIndexForKey:(NSString *eq_key)
NSArray * applyMarketFilter:onMarket:(NSArray *goods,[onMarket] OOCommodityMarket *market)
NSString * planetSearchString
void setLastsaveName:(NSString *value)
NSArray * n_key_system_home
void addMissionDestinationMarker:(NSDictionary *marker)
BOOL addEqScriptForKey:(NSString *eq_key)
OOAlertCondition lastScriptAlertCondition
NSMutableDictionary * commodityScripts
NSArray * n_key_custom_view_zoom_in
void clearRolesFromPlayer:(float chance)
NSDictionary * defaultMarker:(OOSystemID system)
NSArray * n_key_chart_highlight
NSDictionary * _equipScreenBackgroundDescriptor
NSArray * n_key_mode_equipment
BOOL setWeaponMount:toWeapon:inContext:(OOWeaponFacing facing,[toWeapon] NSString *eqKey,[inContext] NSString *context)
BOOL suppressClangStuff()
void completeSetUpAndSetTarget:(BOOL setTarget)
OOTrumble * trumble[PLAYER_MAX_TRUMBLES]
OOSystemID currentSystemID()
NSString * dial_objinfo()
void showMarketScreenHeaders()
void calculateCurrentCargo()
NSArray * n_key_inject_fuel
float maxForwardShieldLevel()
void setupStartScreenGui()
NSArray * n_key_hyperspace
double escape_pod_rescue_time
void performWitchspaceCountdownUpdates:(OOTimeDelta delta_t)
NSArray * n_key_custom_view_rotate_up
NSString * processEscapePods()
OOWeaponType weaponForFacing:(OOWeaponFacing facing)
NSArray * n_key_increase_speed
void updateAlertCondition()
void playCantBuyCommodity()
unsigned keyboardYawOverride
void showMarketScreenDataLine:forGood:inMarket:holdQuantity:(OOGUIRow row, [forGood] OOCommodityType good, [inMarket] OOCommodityMarket *localMarket, [holdQuantity] OOCargoQuantity quantity)
NSArray * n_key_system_next_system
void setInfoSystemID:moveChart:(OOSystemID sid,[moveChart] BOOL moveChart)
void setTrumbleValueFrom:(NSObject *trumbleValue)
void addEquipmentFromCollection:(id equipment)
NSUInteger target_memory_index
void validateCustomEquipActivationArray()
BOOL takeInternalDamage()
NSArray * n_key_system_end
void unloadCargoPodsForType:amount:(OOCommodityType type,[amount] OOCargoQuantity quantity)
OOFuelScoopStatus dialFuelScoopStatus()
void doWorldScriptEvent:inContext:withArguments:count:timeLimit:(jsid message,[inContext] JSContext *context,[withArguments] jsval *argv,[count] uintN argc,[timeLimit] OOTimeDelta limit)
NSArray * n_key_debug_bounding_boxes
NSArray * n_key_market_sell_one
void noteGUIWillChangeTo:(OOGUIScreenID toScreen)
void playNoTargetInMemory()
NSString * dialTargetName()
void takeHeatDamage:(double amount)
NSPoint target_chart_focus
void playHyperspaceDistanceTooGreat()
void playMineLaunched:weaponIdentifier:(Vector weaponOffset,[weaponIdentifier] NSString *weaponIdentifier)
Vector viewpointOffsetPort()
NSArray * n_key_custom_view_rotate_right
void doBookkeeping:(double delta_t)
BOOL addEquipmentItem:inContext:(NSString *equipmentKey, [inContext] NSString *context)
NSMutableDictionary * getMissionDestinations()
NSArray * n_key_market_sorter_cycle
NSArray * n_key_scanner_unzoom
NSArray * n_key_gui_arrow_left
void showInformationForSelectedInterface()
OOEnergyUnitType energyUnitType()
Quaternion customViewQuaternion
void applyRoll:andClimb:(GLfloat roll1, [andClimb] GLfloat climb1)
NSArray * n_key_view_starboard
NSMutableArray * targetMemory()
BOOL validForAddToUniverse()
OOScalar target_chart_zoom
void playIncomingMissile:(Vector missileVector)
NSString * fastEquipmentA()
void setGuiToDockingReportScreen()
void moveForward:(double amount)
Vector customViewRightVector
void setDefaultCustomViews()
ShipEntity * missile_entity[PLAYER_MAX_MISSILES]
void playAlertConditionRed()
BOOL activateCloakingDevice()
NSArray * n_key_pitch_back
OOCommodityType dumpCargo()
NSDictionary * worldScriptsRequiringTickle
NSMutableArray * customEquipmentActivation()
NSString * _commanderName
NSMutableDictionary * mission_variables
NSString * currentPrimedEquipment()
NSMutableDictionary * parcel_record
BOOL showingLongRangeChart
NSArray * multiFunctionDisplayList()
NSArray * n_key_mouse_control_roll
NSUInteger primedEquipmentCount()
OOGUIBackgroundSpecial missionBackgroundSpecial()
void playHyperspaceNoTarget()
void previousInfoSystem()
BOOL setUpAndConfirmOK:(BOOL stopOnError)
NSArray * n_key_launch_ship
BOOL setUpAndConfirmOK:saveGame:(BOOL stopOnError,[saveGame] BOOL loadingGame)
void showInformationForSelectedUpgradeWithFormatString:(NSString *extraString)
HPVector breakPatternPosition()
NSArray * n_key_gui_market
OOCreditsQuantity credits
NSDictionary * _missionBackgroundDescriptor
OOCargoQuantity cargoQuantityOnBoard()
NSArray * passengerListForScripting()
void playWitchjumpBlocked()
NSArray * n_key_launch_missile
OOTimeDelta aft_shot_time
OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour
NSPoint cursor_coordinates
NSArray * n_key_gui_system_data
static NSString * SliderString(NSInteger amountIn20ths)
NSArray * n_key_gui_screen_equipship
ShipEntity * fireMissile()
NSUInteger _customViewIndex
void setCompassMode:(OOCompassMode value)
void highlightEquipShipScreenKey:(NSString *key)
NSArray * n_key_debug_console_connect
NSMutableArray * eqScripts
void setJumpCause:(NSString *value)
OOCargoQuantity cargoQuantityForType:(OOCommodityType type)
NSArray * n_key_info_previous_system
GLfloat dialForwardShield()
void setDockedAtMainStation()
void playJumpMassLocked()
NSArray * n_key_custom_view_rotate_down
Vector viewpointOffsetForward()
unsigned keyboardRollOverride
void loadCargoPodsForType:amount:(OOCommodityType type,[amount] OOCargoQuantity quantity)
void setGuiToSystemDataScreenRefreshBackground:(BOOL refreshBackground)
NSDictionary * missionOverlayDescriptor()
void setDefaultViewOffsets()
OOTrumble ** trumbleArray()
void mungChecksumWithNSString:(NSString *str)
NSArray * n_key_prime_next_equipment
void setPreviousSystemID:(OOSystemID sid)
void removeEquipmentItem:(NSString *equipmentKey)
void playCloakingDeviceOff()
void selectPreviousMultiFunctionDisplay()
OOSystemID infoSystemID()
void doGuiScreenResizeUpdates()
NSArray * n_key_custom_view_pan_up
NSArray * n_key_ident_system
GLfloat scanner_zoom_rate
OOSpeechSettings isSpeechOn
void setGuiToShortRangeChartScreen()
NSString * fastEquipmentB()
NSPoint adjusted_chart_centre()
NSArray * n_key_oxzmanager_setfilter
OOUniversalID _dockTarget
void setDockedStation:(StationEntity *station)
NSArray * n_key_gui_page_down
OOScalar custom_chart_zoom
NSArray * n_key_decrease_speed
void currentWeaponStats()
double hyperspaceJumpDistance()
NSMutableDictionary * multiFunctionDisplayText
NSMutableArray * multiFunctionDisplaySettings
void setGuiToOXZManager()
NSArray * n_key_target_incoming_missile
void performDockingRequest:(StationEntity *stationForDocking)
void playCloakingDeviceInsufficientEnergy()
NSArray * n_key_next_missile
OOMatrix customViewMatrix
NSString * lastsaveName()
NSArray * contractListForScripting()
void addMessageToReport:(NSString *report)
OOMissileStatus dialMissileStatus()
NSString * _fastEquipmentA
void disengageAutopilot()
OOSystemID found_system_id
unsigned using_mining_laser
Vector customViewUpVector
void loadCargoPodsForType:fromManifest:(OOCommodityType type,[fromManifest] OOCommodityMarket *manifest)
NSArray * n_key_gui_screen_options
void playWitchjumpMisjump()
NSArray * n_key_prime_previous_equipment
NSArray * n_key_oxzmanager_showinfo
void initialiseMissionDestinations:andLegacy:(NSDictionary *destinations,[andLegacy] NSArray *legacy)
NSArray * cargoListForScripting()
NSArray * n_key_comms_log
unsigned hyperspeed_locked
void applyYaw:(GLfloat yaw)
NSUInteger passengerCapacity()
void setScriptTarget:(ShipEntity *ship)
OOAlertCondition alertCondition
NSArray * n_key_view_port
NSArray * n_key_market_filter_cycle
void validateCompassTarget()
NSPoint galacticHyperspaceFixedCoords
NSDictionary * markedDestinations()
void setGalacticHyperspaceFixedCoordsTo:(NSString *galacticHyperspaceFixedCoordsString)
NSArray * n_key_target_missile
NSArray * n_key_map_zoom_out
NSArray * n_key_switch_next_mfd
OOTimeDelta starboard_shot_time
unsigned galactic_witchjump
NSArray * n_key_advanced_nav_array_next
void printIdentLockedOnForMissile:(BOOL missile)
float forwardShieldRechargeRate()
NSString * marketScreenTitle()
NSMutableDictionary * shipyard_record
NSUInteger maxPlayerRoles()
void performDockingUpdates:(OOTimeDelta delta_t)
NSArray * n_key_pitch_forward
void playMissileLockedOn()
Vector customViewForwardVector
void playDockWithStation()
void addTarget:(Entity *targetEntity)
OOGUIScreenID guiScreen()
NSArray * n_key_fire_lasers
void setGalacticHyperspaceBehaviourTo:(NSString *galacticHyperspaceBehaviourString)
void updateFuelScoopSoundWithInterval:(OOTimeDelta delta_t)
void noteGUIDidChangeFrom:to:(OOGUIScreenID fromScreen,[to] OOGUIScreenID toScreen)
void setMissionOverlayDescriptor:(NSDictionary *descriptor)
NSMutableArray * customModePressed
HPVector viewpointPosition()
float aftShieldRechargeRate()
void enterDock:(StationEntity *station)
void updateFuelScoops:(OOTimeDelta delta_t)
NSDictionary * worldScripts
OOMissileStatus missile_status
void playHyperspaceAborted()
OOPlayerFleeingStatus fleeingStatus()
void setCustomViewDataFromDictionary:withScaling:(NSDictionary *viewDict,[withScaling] BOOL withScaling)
float maxAftShieldLevel()
GLfloat forward_shield_recharge_rate
BOOL _missionWithCallback
WormholeEntity * wormhole
GLfloat insideAtmosphereFraction()
void addRoleToPlayer:inSlot:(NSString *role,[inSlot] NSUInteger slot)
OOSystemID nextHopTargetSystemID()
NSArray * n_key_mouse_control_yaw
void setTrumbleAppetiteAccumulator:(float value)
NSMutableArray * scannedWormholes
NSDictionary * parcelContractMarker:(OOSystemID system)
NSArray * n_key_fastactivate_equipment_b
void setBackgroundFromDescriptionsKey:(NSString *d_key)
void setEquipScreenBackgroundDescriptor:(NSDictionary *descriptor)
NSArray * n_key_debug_collision
unsigned legalStatusOfCargoList()
NSMutableArray * customActivatePressed
double script_time_interval
NSArray * n_key_docking_music
void createCargoPodWithType:andAmount:(OOCommodityType type, [andAmount] OOCargoQuantity amount)
NSArray * applyMarketSorter:onMarket:(NSArray *goods,[onMarket] OOCommodityMarket *market)
OOCommodityType marketSelectedCommodity
void noteSwitchToView:fromView:(OOViewID toView,[fromView] OOViewID fromView)
void adjustTradeInFactorBy:(int value)
NSArray * n_key_custom_view_pan_right
void removeAllCargo:(BOOL forceRemoval)
NSArray * n_key_dump_cargo
GLfloat laserHeatLevelAft()
NSPoint chart_focus_coordinates
NSDictionary * missionBackgroundDescriptorOrDefault()
NSArray * n_key_launch_escapepod
NSPoint target_chart_centre
void playShieldHit:weaponIdentifier:(Vector attackVector,[weaponIdentifier] NSString *weaponIdentifier)
void orientationChanged()
void showInformationForSelectedUpgrade()
OOFuelQuantity fuelRequiredForJump()
NSArray * n_key_custom_view_roll_left
NSMutableArray * customEquipActivation
GLfloat aft_shield_recharge_rate
OOTimeDelta port_shot_time
OOCompassMode compassMode
void playAegisCloseToPlanet()
void selectNextMultiFunctionDisplay()
OOGUIBackgroundSpecial _missionBackgroundSpecial
void setGuiToEquipShipScreen:(int skip)
NSString * dial_clock_adjusted()
NSUInteger primedEquipment
NSArray * n_key_map_previous_system
NSDictionary * missionOverlayDescriptorOrDefault()
BOOL doWorldEventUntilMissionScreen:(jsid message)
OOCommodityMarket * localMarket()
void playAegisCloseToStation()
unsigned suppressTargetLost
NSMutableDictionary * extraGuiScreenKeys
unsigned ecm_in_operation
void playCargoJettisioned()
NSArray * processKeyCode:(NSArray *key_def)
double clockTimeAdjusted()
NSArray * n_key_fastactivate_equipment_a
NSString * customViewDescription
void setCommanderName:(NSString *value)
NSArray * n_key_hud_toggle
OOSystemID target_system_id
NSArray * n_key_switch_previous_mfd
PlayerEntity * sharedPlayer()
NSArray * n_key_previous_target
void playLaunchFromStation()
OOWeaponFacing chosen_weapon_facing
void playExitWitchspace()
NSPoint chart_centre_coordinates
Vector customViewRotationCenter
ProxyPlayerEntity * createDoppelganger()
StationEntity * targetDockStation
NSArray * n_key_map_zoom_in
OOSystemID targetSystemID()
NSArray * currentLaserOffset()
NSDictionary * missionBackgroundDescriptor()
void setFuelLeak:(NSString *value)
NSArray * n_key_next_compass_mode
void updateSystemMemory()
void clearRoleFromPlayer:(BOOL includingLongRange)
void setGalacticHyperspaceFixedCoordsX:y:(unsigned char x,[y] unsigned char y)
void performAutopilotUpdates:(OOTimeDelta delta_t)
NSDictionary * loadScripts()
NSArray * OXPsWithMessagesFound()
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)
BOOL isExplicitlyUnpiloted()
void setDemoStartTime:(OOTimeAbsolute time)
void setMesh:(OOMesh *mesh)
void setTargetStation:(Entity *targetEntity)
void setLastAegisLock:(Entity< OOStellarBody > *lastAegisLock)
void deserializeShipSubEntitiesFrom:(NSString *string)
void setNextBeacon:(Entity< OOBeaconEntity > *beaconShip)
void transitionToAegisNone()
void addTarget:(Entity *targetEntity)
void noteKilledBy:damageType:(Entity *whom,[damageType] OOShipDamageType type)
BOOL hasPrimaryWeapon:(OOWeaponType weaponType)
void broadcastHitByLaserFrom:(ShipEntity *aggressor_ship)
void setDesiredSpeed:(double amount)
NSDictionary * shipInfoDictionary()
void removeEquipmentItem:(NSString *equipmentKey)
void setFuel:(OOFuelQuantity amount)
void removeTarget:(Entity *targetEntity)
GLfloat scriptedMisjumpRange()
OOTimeAbsolute cargo_dump_time
OOWeaponFacing currentWeaponFacing
void setStatus:(OOEntityStatus stat)
GLfloat weapon_energy_use
BOOL addEquipmentItem:withValidation:inContext:(NSString *equipmentKey,[withValidation] BOOL validateAddition,[inContext] NSString *context)
void setRoll:(double amount)
void setThrust:(double amount)
GLfloat _scriptedMisjumpRange
void setSpeed:(double amount)
void takeScrapeDamage:from:(double amount,[from] Entity *ent)
unsigned suppressAegisMessages
int checkShipsInVicinityForWitchJumpExit()
NSUInteger missileCount()
BOOL fireLaserShotInDirection:weaponIdentifier:(OOWeaponFacing direction,[weaponIdentifier] NSString *weaponIdentifier)
OOCargoQuantity availableCargoSpace()
void doScriptEvent:(jsid message)
void receiveCommsMessage:from:(NSString *message_text,[from] ShipEntity *other)
void wasAddedToUniverse()
OOCargoType dumpItem:(ShipEntity *jetto)
GLint entityPersonalityInt()
Entity * primaryAggressor()
void setPrimaryRole:(NSString *role)
OOWeaponType aft_weapon_type
void deactivateCloakingDevice()
BoundingBox totalBoundingBox
BOOL hasEquipmentItem:(id equipmentKeys)
BOOL removeExternalStore:(OOEquipmentType *eqType)
OOWeakReference * _primaryTarget
NSEnumerator * equipmentEnumerator()
void drawImmediate:translucent:(bool immediate, [translucent] bool translucent)
void setHeatInsulation:(GLfloat value)
void resetExhaustPlumes()
OOFuelQuantity fuelCapacity()
OOEquipmentType * missile_list[SHIPENTITY_MAX_MISSILES]
BOOL hasMilitaryScannerFilter()
StationEntity * targetStation()
uint16_t entity_personality
NSString * serializeShipSubEntities()
NSString * identFromShip:(ShipEntity *otherShip)
GLfloat forward_weapon_temp
BOOL cascadeIfAppropriateWithDamageAmount:cascadeOwner:(double amount,[cascadeOwner] Entity *owner)
void removeAllEquipment()
NSString * shipUniqueName
NSUInteger missileCapacity()
void setShipDataKey:(NSString *key)
OOCommodityType dumpCargo()
GLfloat starboard_weapon_temp
void setAITo:(NSString *aiString)
void becomeLargeExplosion:(double factor)
float energyRechargeRate()
void setWeaponDataFromType:(OOWeaponType weapon_type)
NSEnumerator * shipSubEntityEnumerator()
void noteTargetDestroyed:(ShipEntity *target)
Vector missileLaunchPosition()
NSArray * laserPortOffset:(OOWeaponFacing direction)
Entity< OOStellarBody > * findNearestStellarBody()
void setPendingEscortCount:(uint8_t count)
NSString * equipmentItemProviding:(NSString *equipmentType)
OOWeaponFacingSet weaponFacings()
void doScriptEvent:withArguments:(jsid message,[withArguments] NSArray *arguments)
OOWeaponType starboard_weapon_type
void setScriptedMisjumpRange:(GLfloat newValue)
unsigned scripted_misjump
void setEntityPersonalityInt:(uint16_t value)
BOOL canScoop:(ShipEntity *other)
unsigned military_jammer_active
OOCargoQuantity commodityAmount()
GLfloat weapon_shot_temperature
void doScriptEvent:inContext:withArguments:count:(jsid message,[inContext] JSContext *context,[withArguments] jsval *argv,[count] uintN argc)
OOCargoQuantity maxAvailableCargoSpace()
void update:(OOTimeDelta delta_t)
uint8_t pendingEscortCount()
void noteTakingDamage:from:type:(double amount,[from] Entity *entity,[type] OOShipDamageType type)
void setScriptedMisjump:(BOOL newValue)
void takeHeatDamage:(double amount)
ShipEntity * fireMissileWithIdentifier:andTarget:(NSString *identifier,[andTarget] Entity *target)
float afterburnerFactor()
void processBehaviour:(OOTimeDelta delta_t)
OOWeaponType port_weapon_type
Entity< OOBeaconEntity > * nextBeacon()
double maxHyperspaceDistance()
OOCargoQuantity max_cargo
void setDemoShip:(OOScalar demoRate)
void setBehaviour:(OOBehaviour cond)
NSUInteger maxShipSubEntities()
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)
BOOL hasHyperspaceMotor()
OOAegisStatus checkForAegis()
Triangle absoluteIJKForSubentity()
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)
OOWeaponType forward_weapon_type
unsigned cloaking_device_active
OOCargoQuantity extra_cargo
NSMutableArray * subEntities
OOCommodityType commodityType()
void setOwner:(Entity *who_owns_entity)
BoundingBox findSubentityBoundingBox()
BOOL hasExpandedCargoBay()
NSUInteger countEquipmentItem:(NSString *eqkey)
OOWeakReference * _foundTarget
void setShipUniqueName:(NSString *inName)
void setShipClassName:(NSString *inName)
OOCommodityMarket * localMarket
OOCommodityMarket * initialiseLocalMarket()
void autoDockShipsOnApproach()
OOCreditsQuantity legalStatusOfManifest:export:(OOCommodityMarket *manifest,[export] BOOL export)
void launchShip:(ShipEntity *ship)
NSMutableDictionary * localInterfaces
NSString * acceptDockingClearanceRequestFrom:(ShipEntity *other)
OOTechLevelID equivalentTechLevel
void noteDockedShip:(ShipEntity *ship)
float equipmentPriceFactor
void clearDockingCorridor()
double estimatedArrivalTime()
void setContainsPlayer:(BOOL val)
void setExitPosition:(HPVector pos)
void setMisjumpWithRange:(GLfloat range)
void setScannedAt:(double time)
void setExitSpeed:(double speed)
void setScanInfo:(WORMHOLE_SCANINFO scanInfo)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
RANROTSeed RANROTGetFullSeed(void)
void setRandomSeed(RNG_Seed a_seed)
int16_t munge_checksum(long long value_)
RNG_Seed currentRandomSeed(void)
void RANROTSetFullSeed(RANROTSeed seed)
double cunningFee(double value, double precision)
OOINLINE double distanceBetweenPlanetPositions(int x1, int y1, int x2, int y2) INLINE_CONST_FUNC