Merge pull request #186 from OoliteProject/ANA_info
System information facility for all systems on a route.
This commit is contained in:
commit
63322e6b85
@ -11,6 +11,7 @@ General:
|
||||
as a cheat
|
||||
* Atmospheric fog is now applied also with shaders enabled
|
||||
* Add mobile external view camera
|
||||
* Add ability to inspect system information for all systems along ANA route
|
||||
|
||||
Expansion pack development:
|
||||
===========================
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 391c76d8ab72094cceb57349ea529166fa73f199
|
||||
Subproject commit 49b3f7f342ba85c0b7bbbfae8cd1416809ea0f7b
|
@ -1272,6 +1272,8 @@
|
||||
"oolite-keydesc-key_docking_music" = "Docking music";
|
||||
|
||||
"oolite-keydesc-key_advanced_nav_array" = "Route planner";
|
||||
"oolite-keydesc-key_next_info_system" = "Next Planet Info";
|
||||
"oolite-keydesc-key_previous_info_system" = "Previous Planet Info";
|
||||
"oolite-keydesc-key_map_home" = "Home map";
|
||||
"oolite-keydesc-key_map_info" = "Show chart icons";
|
||||
|
||||
|
@ -158,9 +158,12 @@
|
||||
/* color of location crosshair */
|
||||
// "chart_crosshair_color" = "greenColor";
|
||||
|
||||
/* color of fuel range circle */
|
||||
/* color of chart cursor */
|
||||
// "chart_cursor_color" = "redColor";
|
||||
|
||||
/* color of info system marker */
|
||||
// "chart_info_marker_color" = "blueColor";
|
||||
|
||||
/* color of matched system box when name searching */
|
||||
// "chart_match_color" = "greenColor";
|
||||
|
||||
|
2
deps/Windows-deps
vendored
2
deps/Windows-deps
vendored
@ -1 +1 @@
|
||||
Subproject commit e8f45e81fe5bafe1fb972d940cab11634defff3e
|
||||
Subproject commit fa987fe850f078054d1ef226fda4c811991b5284
|
@ -361,6 +361,7 @@ typedef enum
|
||||
@private
|
||||
OOSystemID system_id;
|
||||
OOSystemID target_system_id;
|
||||
OOSystemID info_system_id;
|
||||
|
||||
float occlusion_dial;
|
||||
|
||||
@ -488,6 +489,7 @@ typedef enum
|
||||
NSPoint chart_centre_coordinates;
|
||||
// where we want the chart centre to be - used for smooth transitions
|
||||
NSPoint target_chart_centre;
|
||||
NSPoint target_chart_focus;
|
||||
// Chart zoom is 1.0 when fully zoomed in and increases as we zoom out. The reason I've done it that way round
|
||||
// is because we might want to implement bigger galaxies one day, and thus may need to zoom out indefinitely.
|
||||
OOScalar chart_zoom;
|
||||
@ -586,6 +588,8 @@ typedef enum
|
||||
OOKeyCode key_docking_music;
|
||||
|
||||
OOKeyCode key_advanced_nav_array;
|
||||
OOKeyCode key_info_next_system;
|
||||
OOKeyCode key_info_previous_system;
|
||||
OOKeyCode key_map_home;
|
||||
OOKeyCode key_map_info;
|
||||
|
||||
@ -778,6 +782,13 @@ typedef enum
|
||||
- (OOSystemID) targetSystemID;
|
||||
- (void) setTargetSystemID:(OOSystemID) sid;
|
||||
- (OOSystemID) nextHopTargetSystemID;
|
||||
- (OOSystemID) infoSystemID;
|
||||
- (void) setInfoSystemID: (OOSystemID) sid;
|
||||
- (void) nextInfoSystem;
|
||||
- (void) previousInfoSystem;
|
||||
- (void) homeInfoSystem;
|
||||
- (void) targetInfoSystem;
|
||||
- (BOOL) infoSystemOnRoute;
|
||||
|
||||
|
||||
- (NSDictionary *) commanderDataDictionary;
|
||||
|
@ -691,6 +691,111 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
}
|
||||
|
||||
|
||||
- (OOSystemID) infoSystemID
|
||||
{
|
||||
return info_system_id;
|
||||
}
|
||||
|
||||
|
||||
- (void) setInfoSystemID: (OOSystemID) sid
|
||||
{
|
||||
info_system_id = sid;
|
||||
}
|
||||
|
||||
|
||||
- (void) nextInfoSystem
|
||||
{
|
||||
if (ANA_mode == OPTIMIZED_BY_NONE)
|
||||
{
|
||||
info_system_id = target_system_id;
|
||||
return;
|
||||
}
|
||||
NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
|
||||
NSUInteger i;
|
||||
if (route == nil)
|
||||
{
|
||||
info_system_id = target_system_id;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < [route count]; i++)
|
||||
{
|
||||
if ([[route objectAtIndex: i] unsignedIntValue] == info_system_id)
|
||||
{
|
||||
if (i + 1 < [route count])
|
||||
{
|
||||
info_system_id = [[route objectAtIndex:i + 1] unsignedIntValue];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
[route release];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
- (void) previousInfoSystem
|
||||
{
|
||||
if (ANA_mode == OPTIMIZED_BY_NONE)
|
||||
{
|
||||
info_system_id = system_id;
|
||||
return;
|
||||
}
|
||||
NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
|
||||
NSUInteger i;
|
||||
if (route == nil)
|
||||
{
|
||||
info_system_id = system_id;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < [route count]; i++)
|
||||
{
|
||||
if ([[route objectAtIndex: i] unsignedIntValue] == info_system_id)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
info_system_id = [[route objectAtIndex: i - 1] unsignedIntValue];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
[route release];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
- (void) homeInfoSystem
|
||||
{
|
||||
info_system_id = system_id;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
- (void) targetInfoSystem
|
||||
{
|
||||
info_system_id = target_system_id;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) infoSystemOnRoute
|
||||
{
|
||||
NSArray *route = [[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"];
|
||||
NSUInteger i;
|
||||
if (route == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
for (i = 0; i < [route count]; i++)
|
||||
{
|
||||
if ([[route objectAtIndex: i] unsignedIntValue] == info_system_id)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (WormholeEntity *) wormhole
|
||||
{
|
||||
return wormhole;
|
||||
@ -1055,12 +1160,14 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
|
||||
|
||||
target_system_id = [dict oo_intForKey:@"target_id" defaultValue:system_id];
|
||||
info_system_id = target_system_id;
|
||||
coord_vals = ScanTokensFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:target_system_id inGalaxy:galaxy_number]);
|
||||
cursor_coordinates.x = [coord_vals oo_unsignedCharAtIndex:0];
|
||||
cursor_coordinates.y = [coord_vals oo_unsignedCharAtIndex:1];
|
||||
|
||||
chart_cursor_coordinates = cursor_coordinates;
|
||||
chart_focus_coordinates = chart_centre_coordinates;
|
||||
target_chart_focus = chart_focus_coordinates;
|
||||
|
||||
found_system_id = [dict oo_intForKey:@"found_system_id" defaultValue:-1];
|
||||
}
|
||||
@ -1092,6 +1199,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
}
|
||||
chart_cursor_coordinates = cursor_coordinates;
|
||||
chart_focus_coordinates = chart_centre_coordinates;
|
||||
target_chart_focus = chart_focus_coordinates;
|
||||
|
||||
// calculate system ID, target ID
|
||||
if ([dict objectForKey:@"current_system_name"])
|
||||
@ -1114,6 +1222,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
{
|
||||
target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:YES];
|
||||
}
|
||||
info_system_id = target_system_id;
|
||||
found_system_id = -1;
|
||||
}
|
||||
|
||||
@ -1927,6 +2036,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
cursor_coordinates = galaxy_coordinates;
|
||||
chart_cursor_coordinates = cursor_coordinates;
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
target_chart_focus = chart_focus_coordinates;
|
||||
chart_zoom = 1.0;
|
||||
target_chart_zoom = 1.0;
|
||||
saved_chart_zoom = 1.0;
|
||||
@ -2697,6 +2807,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
if (EXPECT_NOT(target_system_id != system_id)) // overridden: we're going to a nearby system!
|
||||
{
|
||||
system_id = target_system_id;
|
||||
info_system_id = target_system_id;
|
||||
[UNIVERSE setSystemTo:system_id];
|
||||
galaxy_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:system_id inGalaxy:galaxy_number]);
|
||||
|
||||
@ -6165,6 +6276,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
|
||||
// set up the standard location where the escape pod will dock.
|
||||
target_system_id = system_id; // we're staying in this system
|
||||
info_system_id = system_id;
|
||||
[self setDockTarget:[UNIVERSE station]]; // we're docking at the main station, if there is one
|
||||
|
||||
[self doScriptEvent:OOJSID("shipLaunchedEscapePod") withArgument:escapePod]; // no player.ship properties should be available to script
|
||||
@ -7100,6 +7212,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
break;
|
||||
}
|
||||
target_system_id = system_id;
|
||||
info_system_id = system_id;
|
||||
|
||||
[self setBounty:0 withReason:kOOLegalStatusReasonNewGalaxy]; // let's make a fresh start!
|
||||
cursor_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:system_id inGalaxy:galaxy_number]);
|
||||
@ -7903,22 +8016,21 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
|
||||
- (void) setGuiToSystemDataScreen
|
||||
{
|
||||
NSDictionary *targetSystemData;
|
||||
NSString *targetSystemName;
|
||||
NSDictionary *infoSystemData;
|
||||
NSString *infoSystemName;
|
||||
|
||||
targetSystemData = [[UNIVERSE generateSystemData:target_system_id] retain]; // retained
|
||||
NSInteger concealment = [targetSystemData oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
|
||||
infoSystemData = [[UNIVERSE generateSystemData:info_system_id] retain]; // retained
|
||||
NSInteger concealment = [infoSystemData oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
|
||||
infoSystemName = [infoSystemData oo_stringForKey:KEY_NAME];
|
||||
|
||||
targetSystemName = [targetSystemData oo_stringForKey:KEY_NAME];
|
||||
|
||||
BOOL sunGoneNova = ([targetSystemData oo_boolForKey:@"sun_gone_nova"]);
|
||||
BOOL sunGoneNova = ([infoSystemData oo_boolForKey:@"sun_gone_nova"]);
|
||||
OOGUIScreenID oldScreen = gui_screen;
|
||||
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
gui_screen = GUI_SCREEN_SYSTEM_DATA;
|
||||
BOOL guiChanged = (oldScreen != gui_screen);
|
||||
|
||||
Random_Seed targetSystemRandomSeed = [[UNIVERSE systemManager] getRandomSeedForSystem:target_system_id
|
||||
Random_Seed infoSystemRandomSeed = [[UNIVERSE systemManager] getRandomSeedForSystem:info_system_id
|
||||
inGalaxy:[self galaxyNumber]];
|
||||
|
||||
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
|
||||
@ -7932,19 +8044,19 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
[gui overrideTabs:tab_stops from:kGuiSystemdataTabs length:3];
|
||||
[gui setTabStops:tab_stops];
|
||||
|
||||
NSUInteger techLevel = [targetSystemData oo_intForKey:KEY_TECHLEVEL] + 1;
|
||||
int population = [targetSystemData oo_intForKey:KEY_POPULATION];
|
||||
int productivity = [targetSystemData oo_intForKey:KEY_PRODUCTIVITY];
|
||||
int radius = [targetSystemData oo_intForKey:KEY_RADIUS];
|
||||
NSUInteger techLevel = [infoSystemData oo_intForKey:KEY_TECHLEVEL] + 1;
|
||||
int population = [infoSystemData oo_intForKey:KEY_POPULATION];
|
||||
int productivity = [infoSystemData oo_intForKey:KEY_PRODUCTIVITY];
|
||||
int radius = [infoSystemData oo_intForKey:KEY_RADIUS];
|
||||
|
||||
NSString *government_desc = [targetSystemData oo_stringForKey:KEY_GOVERNMENT_DESC
|
||||
defaultValue:OODisplayStringFromGovernmentID([targetSystemData oo_intForKey:KEY_GOVERNMENT])];
|
||||
NSString *economy_desc = [targetSystemData oo_stringForKey:KEY_ECONOMY_DESC
|
||||
defaultValue:OODisplayStringFromEconomyID([targetSystemData oo_intForKey:KEY_ECONOMY])];
|
||||
NSString *inhabitants = [targetSystemData oo_stringForKey:KEY_INHABITANTS];
|
||||
NSString *system_desc = [targetSystemData oo_stringForKey:KEY_DESCRIPTION];
|
||||
NSString *government_desc = [infoSystemData oo_stringForKey:KEY_GOVERNMENT_DESC
|
||||
defaultValue:OODisplayStringFromGovernmentID([infoSystemData oo_intForKey:KEY_GOVERNMENT])];
|
||||
NSString *economy_desc = [infoSystemData oo_stringForKey:KEY_ECONOMY_DESC
|
||||
defaultValue:OODisplayStringFromEconomyID([infoSystemData oo_intForKey:KEY_ECONOMY])];
|
||||
NSString *inhabitants = [infoSystemData oo_stringForKey:KEY_INHABITANTS];
|
||||
NSString *system_desc = [infoSystemData oo_stringForKey:KEY_DESCRIPTION];
|
||||
|
||||
NSString *populationDesc = [targetSystemData oo_stringForKey:KEY_POPULATION_DESC
|
||||
NSString *populationDesc = [infoSystemData oo_stringForKey:KEY_POPULATION_DESC
|
||||
defaultValue:OOExpandKeyWithSeed(kNilRandomSeed, @"sysdata-pop-value", population, inhabitants)];
|
||||
|
||||
if (sunGoneNova)
|
||||
@ -7953,14 +8065,15 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
productivity = 0;
|
||||
radius = 0;
|
||||
techLevel = 0;
|
||||
government_desc = OOExpandKeyWithSeed(targetSystemRandomSeed, @"nova-system-government");
|
||||
economy_desc = OOExpandKeyWithSeed(targetSystemRandomSeed, @"nova-system-economy");
|
||||
inhabitants = OOExpandKeyWithSeed(targetSystemRandomSeed, @"nova-system-inhabitants");
|
||||
|
||||
government_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-government");
|
||||
economy_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-economy");
|
||||
inhabitants = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-inhabitants");
|
||||
{
|
||||
NSString *system = targetSystemName;
|
||||
system_desc = OOExpandKeyWithSeed(targetSystemRandomSeed, @"nova-system-description", system);
|
||||
NSString *system = infoSystemName;
|
||||
system_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-description", system);
|
||||
}
|
||||
populationDesc = OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-pop-value", population, inhabitants);
|
||||
populationDesc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-pop-value", population, inhabitants);
|
||||
}
|
||||
|
||||
|
||||
@ -7969,68 +8082,48 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
|
||||
if (concealment < OO_SYSTEMCONCEALMENT_NONAME)
|
||||
{
|
||||
|
||||
NSString *system = targetSystemName;
|
||||
[gui setTitle:OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-data-on-system", system)];
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui setTitle:OOExpandKey(@"sysdata-data-on-system-no-name")];
|
||||
}
|
||||
|
||||
if (concealment >= OO_SYSTEMCONCEALMENT_NODATA)
|
||||
{
|
||||
OOGUIRow i = [gui addLongText:OOExpandKey(@"sysdata-data-on-system-no-data") startingAtRow:15 align:GUI_ALIGN_LEFT];
|
||||
missionTextRow = i;
|
||||
for (i-- ; i > 14 ; --i)
|
||||
{
|
||||
[gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
NSString *system = infoSystemName;
|
||||
[gui setTitle:OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-data-on-system", system)];
|
||||
NSArray *populationDescLines = [populationDesc componentsSeparatedByString:@"\n"];
|
||||
NSString *populationDesc1 = [populationDescLines objectAtIndex:0];
|
||||
NSString *populationDesc2 = [populationDescLines lastObject];
|
||||
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-eco"),
|
||||
economy_desc,
|
||||
nil]
|
||||
forRow:1];
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-eco"),
|
||||
economy_desc,
|
||||
nil]
|
||||
forRow:1];
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-govt"),
|
||||
government_desc,
|
||||
nil]
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-govt"),
|
||||
government_desc,
|
||||
nil]
|
||||
forRow:3];
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-tl"),
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-tl-value", techLevel),
|
||||
nil]
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-tl"),
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-tl-value", techLevel),
|
||||
nil]
|
||||
forRow:5];
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-pop"),
|
||||
populationDesc1,
|
||||
nil]
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-pop"),
|
||||
populationDesc1,
|
||||
nil]
|
||||
forRow:7];
|
||||
[gui setArray:[NSArray arrayWithObjects:@"",
|
||||
populationDesc2,
|
||||
nil]
|
||||
populationDesc2,
|
||||
nil]
|
||||
forRow:8];
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-prod"),
|
||||
@"",
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-prod-value", productivity),
|
||||
nil]
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-prod"),
|
||||
@"",
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-prod-value", productivity),
|
||||
nil]
|
||||
forRow:10];
|
||||
[gui setArray:[NSArray arrayWithObjects:
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-radius"),
|
||||
@"",
|
||||
OOExpandKeyWithSeed(targetSystemRandomSeed, @"sysdata-radius-value",
|
||||
radius),
|
||||
nil]
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-radius"),
|
||||
@"",
|
||||
OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-radius-value",
|
||||
radius),
|
||||
nil]
|
||||
forRow:12];
|
||||
|
||||
OOGUIRow i = [gui addLongText:system_desc startingAtRow:15 align:GUI_ALIGN_LEFT];
|
||||
@ -8045,6 +8138,16 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
[gui setColor:[gui colorFromSetting:kGuiSystemdataFactsColor defaultValue:nil] forRow:i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui setTitle:OOExpandKey(@"sysdata-data-on-system-no-name")];
|
||||
OOGUIRow i = [gui addLongText:OOExpandKey(@"sysdata-data-on-system-no-data") startingAtRow:15 align:GUI_ALIGN_LEFT];
|
||||
missionTextRow = i;
|
||||
for (i-- ; i > 14 ; --i)
|
||||
{
|
||||
[gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
|
||||
}
|
||||
}
|
||||
|
||||
[gui setShowTextCursor:NO];
|
||||
}
|
||||
@ -8055,7 +8158,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
|
||||
[[UNIVERSE gameView] clearMouse];
|
||||
|
||||
[targetSystemData release];
|
||||
[infoSystemData release];
|
||||
|
||||
[self setShowDemoShips:NO];
|
||||
[UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
|
||||
@ -8068,7 +8171,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
||||
RANROTSeed ranrotSavedSeed = RANROTGetFullSeed();
|
||||
RNG_Seed saved_seed = currentRandomSeed();
|
||||
|
||||
if (target_system_id == system_id)
|
||||
if (info_system_id == system_id)
|
||||
{
|
||||
[self setBackgroundFromDescriptionsKey:@"gui-scene-show-local-planet"];
|
||||
}
|
||||
|
@ -136,6 +136,10 @@ static BOOL cycleMFD_pressed;
|
||||
static BOOL switchMFD_pressed;
|
||||
static BOOL mouse_left_down;
|
||||
static BOOL oxz_manager_pressed;
|
||||
static BOOL next_planet_info_pressed;
|
||||
static BOOL previous_planet_info_pressed;
|
||||
static BOOL home_info_pressed;
|
||||
static BOOL target_info_pressed;
|
||||
static NSPoint mouse_click_position;
|
||||
static NSPoint centre_at_mouse_click;
|
||||
|
||||
@ -489,6 +493,7 @@ static NSTimeInterval time_last_frame;
|
||||
- (void) targetNewSystem:(int) direction whileTyping:(BOOL) whileTyping
|
||||
{
|
||||
target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
|
||||
info_system_id = target_system_id;
|
||||
cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
|
||||
|
||||
found_system_id = target_system_id;
|
||||
@ -1762,7 +1767,7 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
queryPressed = NO;
|
||||
}
|
||||
|
||||
|
||||
if ([gameView isDown:key_map_info] && chart_zoom <= CHART_ZOOM_SHOW_LABELS)
|
||||
{
|
||||
if (!chartInfoPressed)
|
||||
@ -1802,6 +1807,10 @@ static NSTimeInterval time_last_frame;
|
||||
default: ANA_mode = OPTIMIZED_BY_NONE; break;
|
||||
}
|
||||
}
|
||||
if (ANA_mode == OPTIMIZED_BY_NONE || ![self infoSystemOnRoute])
|
||||
{
|
||||
info_system_id = target_system_id;
|
||||
}
|
||||
}
|
||||
pling_pressed = YES;
|
||||
}
|
||||
@ -1837,6 +1846,7 @@ static NSTimeInterval time_last_frame;
|
||||
mouse_click_position = maus;
|
||||
chart_focus_coordinates.x = OOClamp_0_max_f(centre.x + (maus.x * MAIN_GUI_PIXEL_WIDTH) / hscale, 256.0);
|
||||
chart_focus_coordinates.y = OOClamp_0_max_f(centre.y + (maus.y * MAIN_GUI_PIXEL_HEIGHT + vadjust) / vscale, 256.0);
|
||||
target_chart_focus = chart_focus_coordinates;
|
||||
}
|
||||
if (fabs(maus.x - mouse_click_position.x)*MAIN_GUI_PIXEL_WIDTH > 2 ||
|
||||
fabs(maus.y - mouse_click_position.y)*MAIN_GUI_PIXEL_HEIGHT > 2)
|
||||
@ -1866,20 +1876,32 @@ static NSTimeInterval time_last_frame;
|
||||
}
|
||||
if ([gameView isDown:key_map_home])
|
||||
{
|
||||
[gameView resetTypedString];
|
||||
cursor_coordinates = galaxy_coordinates;
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
target_chart_centre = galaxy_coordinates;
|
||||
found_system_id = -1;
|
||||
[UNIVERSE findSystemCoordinatesWithPrefix:@""];
|
||||
moving = YES;
|
||||
if ([gameView isOptDown])
|
||||
{
|
||||
[self homeInfoSystem];
|
||||
target_chart_focus = galaxy_coordinates;
|
||||
}
|
||||
else
|
||||
{
|
||||
[gameView resetTypedString];
|
||||
cursor_coordinates = galaxy_coordinates;
|
||||
target_chart_focus = cursor_coordinates;
|
||||
target_chart_centre = galaxy_coordinates;
|
||||
found_system_id = -1;
|
||||
[UNIVERSE findSystemCoordinatesWithPrefix:@""];
|
||||
moving = YES;
|
||||
}
|
||||
}
|
||||
if ([gameView isDown:gvEndKey] && [gameView isOptDown])
|
||||
{
|
||||
[self targetInfoSystem];
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
if ([gameView isDown:gvPageDownKey] || [gameView mouseWheelState] == gvMouseWheelDown)
|
||||
{
|
||||
target_chart_zoom *= CHART_ZOOM_SPEED_FACTOR;
|
||||
if (target_chart_zoom > CHART_MAX_ZOOM) target_chart_zoom = CHART_MAX_ZOOM;
|
||||
saved_chart_zoom = target_chart_zoom;
|
||||
moving = YES;
|
||||
}
|
||||
if ([gameView isDown:gvPageUpKey] || [gameView mouseWheelState] == gvMouseWheelUp)
|
||||
{
|
||||
@ -1892,47 +1914,65 @@ static NSTimeInterval time_last_frame;
|
||||
target_chart_zoom /= CHART_ZOOM_SPEED_FACTOR;
|
||||
if (target_chart_zoom < 1.0) target_chart_zoom = 1.0;
|
||||
saved_chart_zoom = target_chart_zoom;
|
||||
moving = YES;
|
||||
//target_chart_centre = cursor_coordinates;
|
||||
chart_focus_coordinates = target_chart_centre;
|
||||
target_chart_focus = target_chart_centre;
|
||||
}
|
||||
|
||||
BOOL nextSystem = [gameView isShiftDown];
|
||||
BOOL nextSystemOnRoute = [gameView isOptDown];
|
||||
|
||||
if ([gameView isDown:key_gui_arrow_left])
|
||||
{
|
||||
if (nextSystem && pressedArrow != key_gui_arrow_left)
|
||||
if ((nextSystem || nextSystemOnRoute) && pressedArrow != key_gui_arrow_left)
|
||||
{
|
||||
[self targetNewSystem:-1];
|
||||
if (nextSystem)
|
||||
{
|
||||
[self targetNewSystem:-1];
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self previousInfoSystem];
|
||||
target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
|
||||
}
|
||||
pressedArrow = key_gui_arrow_left;
|
||||
}
|
||||
else if (!nextSystem)
|
||||
else if (!nextSystem && !nextSystemOnRoute)
|
||||
{
|
||||
[gameView resetTypedString];
|
||||
cursor_coordinates.x -= cursor_speed*delta_t;
|
||||
if (cursor_coordinates.x < 0.0) cursor_coordinates.x = 0.0;
|
||||
moving = YES;
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
pressedArrow = pressedArrow == key_gui_arrow_left ? 0 : pressedArrow;
|
||||
|
||||
if ([gameView isDown:key_gui_arrow_right])
|
||||
{
|
||||
if (nextSystem && pressedArrow != key_gui_arrow_right)
|
||||
if ((nextSystem || nextSystemOnRoute) && pressedArrow != key_gui_arrow_right)
|
||||
{
|
||||
[self targetNewSystem:+1];
|
||||
if (nextSystem)
|
||||
{
|
||||
[self targetNewSystem:+1];
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self nextInfoSystem];
|
||||
target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
|
||||
}
|
||||
pressedArrow = key_gui_arrow_right;
|
||||
}
|
||||
else if (!nextSystem)
|
||||
else if (!nextSystem && !nextSystemOnRoute)
|
||||
{
|
||||
[gameView resetTypedString];
|
||||
cursor_coordinates.x += cursor_speed*delta_t;
|
||||
if (cursor_coordinates.x > 256.0) cursor_coordinates.x = 256.0;
|
||||
moving = YES;
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
pressedArrow = pressedArrow == key_gui_arrow_right ? 0 : pressedArrow;
|
||||
@ -1951,7 +1991,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (cursor_coordinates.y > 256.0) cursor_coordinates.y = 256.0;
|
||||
moving = YES;
|
||||
}
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
pressedArrow = pressedArrow == key_gui_arrow_down ? 0 : pressedArrow;
|
||||
@ -1970,7 +2010,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (cursor_coordinates.y < 0.0) cursor_coordinates.y = 0.0;
|
||||
moving = YES;
|
||||
}
|
||||
chart_focus_coordinates = cursor_coordinates;
|
||||
target_chart_focus = cursor_coordinates;
|
||||
}
|
||||
else
|
||||
pressedArrow = pressedArrow == key_gui_arrow_up ? 0 : pressedArrow;
|
||||
@ -1979,6 +2019,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (found_system_id == -1)
|
||||
{
|
||||
target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
|
||||
info_system_id = target_system_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1987,6 +2028,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (fpos.x != cursor_coordinates.x && fpos.y != cursor_coordinates.y)
|
||||
{
|
||||
target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
|
||||
info_system_id = target_system_id;
|
||||
}
|
||||
}
|
||||
cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
|
||||
@ -2012,11 +2054,66 @@ static NSTimeInterval time_last_frame;
|
||||
chart_zoom = (3.0*chart_zoom + target_chart_zoom)/4.0;
|
||||
chart_cursor_coordinates.x = (3.0*chart_cursor_coordinates.x + cursor_coordinates.x)/4.0;
|
||||
chart_cursor_coordinates.y = (3.0*chart_cursor_coordinates.y + cursor_coordinates.y)/4.0;
|
||||
chart_focus_coordinates.x = (3.0*chart_focus_coordinates.x + target_chart_focus.x)/4.0;
|
||||
chart_focus_coordinates.y = (3.0*chart_focus_coordinates.y + target_chart_focus.y)/4.0;
|
||||
if (cursor_moving || dragging) [self setGuiToChartScreenFrom: gui_screen]; // update graphics
|
||||
cursor_moving = moving;
|
||||
}
|
||||
break;
|
||||
|
||||
case GUI_SCREEN_SYSTEM_DATA:
|
||||
if ([gameView isDown: key_gui_arrow_right])
|
||||
{
|
||||
if (!next_planet_info_pressed)
|
||||
{
|
||||
[self nextInfoSystem];
|
||||
[self setGuiToSystemDataScreen];
|
||||
next_planet_info_pressed = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
next_planet_info_pressed = NO;
|
||||
}
|
||||
if ([gameView isDown: key_gui_arrow_left])
|
||||
{
|
||||
if (!previous_planet_info_pressed)
|
||||
{
|
||||
[self previousInfoSystem];
|
||||
[self setGuiToSystemDataScreen];
|
||||
previous_planet_info_pressed = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
previous_planet_info_pressed = NO;
|
||||
}
|
||||
if ([gameView isDown: gvHomeKey])
|
||||
{
|
||||
if (!home_info_pressed)
|
||||
{
|
||||
[self homeInfoSystem];
|
||||
[self setGuiToSystemDataScreen];
|
||||
home_info_pressed = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
home_info_pressed = NO;
|
||||
}
|
||||
if ([gameView isDown: gvEndKey])
|
||||
{
|
||||
if (!target_info_pressed)
|
||||
{
|
||||
[self targetInfoSystem];
|
||||
[self setGuiToSystemDataScreen];
|
||||
target_info_pressed = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target_info_pressed = NO;
|
||||
}
|
||||
break;
|
||||
|
||||
#if OO_USE_CUSTOM_LOAD_SAVE
|
||||
|
@ -2747,13 +2747,13 @@ static int shipsFound;
|
||||
return NO; // 0........... 1 2 3
|
||||
|
||||
// sunlight position for F7 screen is chosen pseudo randomly from 4 different positions.
|
||||
if (target_system_id & 8)
|
||||
if (info_system_id & 8)
|
||||
{
|
||||
_sysInfoLight = (target_system_id & 2) ? (Vector){ -10000.0, 4000.0, -10000.0 } : (Vector){ -12000.0, -5000.0, -10000.0 };
|
||||
_sysInfoLight = (info_system_id & 2) ? (Vector){ -10000.0, 4000.0, -10000.0 } : (Vector){ -12000.0, -5000.0, -10000.0 };
|
||||
}
|
||||
else
|
||||
{
|
||||
_sysInfoLight = (target_system_id & 2) ? (Vector){ 6000.0, -5000.0, -10000.0 } : (Vector){ 6000.0, 4000.0, -10000.0 };
|
||||
_sysInfoLight = (info_system_id & 2) ? (Vector){ 6000.0, -5000.0, -10000.0 } : (Vector){ 6000.0, 4000.0, -10000.0 };
|
||||
}
|
||||
|
||||
[UNIVERSE setMainLightPosition:_sysInfoLight]; // set light origin
|
||||
@ -2766,7 +2766,7 @@ static int shipsFound;
|
||||
}
|
||||
else
|
||||
{
|
||||
originalPlanet = [[[OOPlanetEntity alloc] initAsMainPlanetForSystem:target_system_id] autorelease];
|
||||
originalPlanet = [[[OOPlanetEntity alloc] initAsMainPlanetForSystem:info_system_id] autorelease];
|
||||
}
|
||||
OOPlanetEntity *doppelganger = [originalPlanet miniatureVersion];
|
||||
if (doppelganger == nil) return NO;
|
||||
|
@ -117,6 +117,7 @@ static NSString * const kGuiChartLabelReachableColor = @"chart_labelreachable_co
|
||||
static NSString * const kGuiChartRangeColor = @"chart_range_color";
|
||||
static NSString * const kGuiChartCrosshairColor = @"chart_crosshair_color";
|
||||
static NSString * const kGuiChartCursorColor = @"chart_cursor_color";
|
||||
static NSString * const kGuiChartInfoMarkerColor = @"chart_info_marker_color";
|
||||
static NSString * const kGuiChartMatchBoxColor = @"chart_match_box_color";
|
||||
static NSString * const kGuiChartMatchLabelColor = @"chart_match_label_color";
|
||||
static NSString * const kGuiChartConnectionColor = @"chart_connection_color";
|
||||
|
@ -1660,6 +1660,7 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
||||
NSPoint chart_centre_coordinates = [player adjusted_chart_centre];
|
||||
NSPoint galaxy_coordinates = [player galaxy_coordinates];
|
||||
NSPoint cursor_coordinates = [player cursor_coordinates];
|
||||
NSPoint info_system_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem: [player infoSystemID] inGalaxy: [player galaxyNumber]];
|
||||
OOLongRangeChartMode chart_mode = [player longRangeChartMode];
|
||||
OOGalaxyID galaxy_id = [player galaxyNumber];
|
||||
GLfloat r = 1.0, g = 1.0, b = 1.0;
|
||||
@ -2199,6 +2200,12 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
||||
cu = NSMakePoint((float)(hscale*cursor_coordinates.x+hoffset),(float)(vscale*cursor_coordinates.y+voffset));
|
||||
[self drawCrossHairsWithSize:7 x:x + cu.x y:y + cu.y z:z];
|
||||
|
||||
// draw planet info circle
|
||||
OOGL(GLScaledLineWidth(2.0f));
|
||||
[self setGLColorFromSetting: kGuiChartInfoMarkerColor defaultValue:[OOColor blueColor] alpha:alpha];
|
||||
cu = NSMakePoint((float)(hscale*info_system_coordinates.x+hoffset),(float)(vscale*info_system_coordinates.y+voffset));
|
||||
GLDrawOval(x + cu.x, y + cu.y, z, NSMakeSize(8.0f, 8.0f), 5);
|
||||
|
||||
// disable draw clipping
|
||||
OOGL(glDisable(GL_SCISSOR_TEST));
|
||||
|
||||
@ -2336,7 +2343,6 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Advanced Navigation Array -- galactic chart route mapping - contributed by Nikos Barkas (another_commander).
|
||||
- (void) drawAdvancedNavArrayAtX:(float)x y:(float)y z:(float)z alpha:(float)alpha usingRoute:(NSDictionary *) routeInfo optimizedBy:(OORouteType) optimizeBy zoom: (OOScalar) zoom
|
||||
{
|
||||
|
@ -61,19 +61,6 @@ enum
|
||||
};
|
||||
|
||||
|
||||
@interface OOPlanetTextureGenerator (Private)
|
||||
|
||||
- (NSString *) cacheKeyForType:(NSString *)type;
|
||||
- (OOTextureGenerator *) normalMapGenerator; // Must be called before generator is enqueued for rendering.
|
||||
- (OOTextureGenerator *) atmosphereGenerator; // Must be called before generator is enqueued for rendering.
|
||||
|
||||
#if DEBUG_DUMP_RAW
|
||||
- (void) dumpNoiseBuffer:(float *)noise;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/* The planet generator actually generates two textures when shaders are
|
||||
active, but the texture loader interface assumes we only load/generate
|
||||
one texture per loader. Rather than complicate that, we use a mock
|
||||
@ -82,6 +69,7 @@ enum
|
||||
@interface OOPlanetNormalMapGenerator: OOTextureGenerator
|
||||
{
|
||||
@private
|
||||
BOOL _enqueued;
|
||||
NSString *_cacheKey;
|
||||
RANROTSeed _seed;
|
||||
}
|
||||
@ -90,6 +78,8 @@ enum
|
||||
|
||||
- (void) completeWithData:(void *)data width:(unsigned)width height:(unsigned)height;
|
||||
|
||||
- (BOOL) enqueued;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -97,6 +87,7 @@ enum
|
||||
@interface OOPlanetAtmosphereGenerator: OOTextureGenerator
|
||||
{
|
||||
@private
|
||||
BOOL _enqueued;
|
||||
NSString *_cacheKey;
|
||||
RANROTSeed _seed;
|
||||
OOPlanetTextureGenerator *_parent;
|
||||
@ -106,6 +97,21 @@ enum
|
||||
|
||||
- (void) completeWithData:(void *)data width:(unsigned)width height:(unsigned)height;
|
||||
|
||||
- (BOOL) enqueued;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface OOPlanetTextureGenerator (Private)
|
||||
|
||||
- (NSString *) cacheKeyForType:(NSString *)type;
|
||||
- (OOPlanetNormalMapGenerator *) normalMapGenerator; // Must be called before generator is enqueued for rendering.
|
||||
- (OOPlanetAtmosphereGenerator *) atmosphereGenerator; // Must be called before generator is enqueued for rendering.
|
||||
|
||||
#if DEBUG_DUMP_RAW
|
||||
- (void) dumpNoiseBuffer:(float *)noise;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -215,13 +221,13 @@ enum
|
||||
OOPlanetTextureGenerator *diffuseGen = [[[self alloc] initWithPlanetInfo:planetInfo] autorelease];
|
||||
if (diffuseGen == nil) return NO;
|
||||
|
||||
OOTextureGenerator *atmoGen = [diffuseGen atmosphereGenerator];
|
||||
OOPlanetAtmosphereGenerator *atmoGen = [diffuseGen atmosphereGenerator];
|
||||
if (atmoGen == nil) return NO;
|
||||
|
||||
*atmosphere = [OOTexture textureWithGenerator:atmoGen];
|
||||
if (*atmosphere == nil) return NO;
|
||||
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen];
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen enqueue: [atmoGen enqueued]];
|
||||
|
||||
return *texture != nil;
|
||||
}
|
||||
@ -230,20 +236,23 @@ enum
|
||||
+ (BOOL) generatePlanetTexture:(OOTexture **)texture secondaryTexture:(OOTexture **)secondaryTexture withInfo:(NSDictionary *)planetInfo
|
||||
{
|
||||
NSParameterAssert(texture != NULL);
|
||||
|
||||
BOOL enqueue = NO;
|
||||
|
||||
OOPlanetTextureGenerator *diffuseGen = [[[self alloc] initWithPlanetInfo:planetInfo] autorelease];
|
||||
if (diffuseGen == nil) return NO;
|
||||
|
||||
if (secondaryTexture != NULL)
|
||||
{
|
||||
OOTextureGenerator *normalGen = [diffuseGen normalMapGenerator];
|
||||
OOPlanetNormalMapGenerator *normalGen = [diffuseGen normalMapGenerator];
|
||||
if (normalGen == nil) return NO;
|
||||
|
||||
*secondaryTexture = [OOTexture textureWithGenerator:normalGen];
|
||||
if (*secondaryTexture == nil) return NO;
|
||||
enqueue = [normalGen enqueued];
|
||||
}
|
||||
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen];
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen enqueue: enqueue];
|
||||
|
||||
return *texture != nil;
|
||||
}
|
||||
@ -253,19 +262,22 @@ enum
|
||||
{
|
||||
NSParameterAssert(texture != NULL);
|
||||
|
||||
BOOL enqueue = NO;
|
||||
|
||||
OOPlanetTextureGenerator *diffuseGen = [[[self alloc] initWithPlanetInfo:planetInfo] autorelease];
|
||||
if (diffuseGen == nil) return NO;
|
||||
|
||||
if (secondaryTexture != NULL)
|
||||
{
|
||||
OOTextureGenerator *normalGen = [diffuseGen normalMapGenerator];
|
||||
OOPlanetNormalMapGenerator *normalGen = [diffuseGen normalMapGenerator];
|
||||
if (normalGen == nil) return NO;
|
||||
|
||||
*secondaryTexture = [OOTexture textureWithGenerator:normalGen];
|
||||
if (*secondaryTexture == nil) return NO;
|
||||
enqueue = [normalGen enqueued];
|
||||
}
|
||||
|
||||
OOTextureGenerator *atmoGen = [diffuseGen atmosphereGenerator];
|
||||
OOPlanetAtmosphereGenerator *atmoGen = [diffuseGen atmosphereGenerator];
|
||||
if (atmoGen == nil) return NO;
|
||||
|
||||
*atmosphere = [OOTexture textureWithGenerator:atmoGen];
|
||||
@ -276,10 +288,11 @@ enum
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
enqueue = enqueue || [atmoGen enqueued];
|
||||
|
||||
OOLog(@"texture.planet.generate",@"Generator %@ has atmosphere %@",diffuseGen,*atmosphere);
|
||||
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen];
|
||||
*texture = [OOTexture textureWithGenerator:diffuseGen enqueue: enqueue];
|
||||
return *texture != nil;
|
||||
}
|
||||
|
||||
@ -325,7 +338,7 @@ enum
|
||||
}
|
||||
|
||||
|
||||
- (OOTextureGenerator *) normalMapGenerator
|
||||
- (OOPlanetNormalMapGenerator *) normalMapGenerator
|
||||
{
|
||||
if (_nMapGenerator == nil)
|
||||
{
|
||||
@ -335,7 +348,7 @@ enum
|
||||
}
|
||||
|
||||
|
||||
- (OOTextureGenerator *) atmosphereGenerator
|
||||
- (OOPlanetAtmosphereGenerator *) atmosphereGenerator
|
||||
{
|
||||
if (_atmoGenerator == nil)
|
||||
{
|
||||
@ -1178,6 +1191,7 @@ static void SetMixConstants(OOPlanetTextureGeneratorInfo *info, float temperatur
|
||||
// AllowCubeMap not used yet but might be in future
|
||||
if ((self = [super initWithPath:[NSString stringWithFormat:@"OOPlanetNormalTexture@%p", self] options:kOOTextureAllowCubeMap]))
|
||||
{
|
||||
_enqueued = NO;
|
||||
_cacheKey = [cacheKey copy];
|
||||
_seed = seed;
|
||||
}
|
||||
@ -1212,10 +1226,17 @@ static void SetMixConstants(OOPlanetTextureGeneratorInfo *info, float temperatur
|
||||
(The alternative would be for it to block a work thread waiting for
|
||||
the real generator to complete, which seemed silly.)
|
||||
*/
|
||||
_enqueued = YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) enqueued
|
||||
{
|
||||
return _enqueued;
|
||||
}
|
||||
|
||||
|
||||
- (void) loadTexture
|
||||
{
|
||||
// Do nothing.
|
||||
@ -1259,6 +1280,7 @@ static void SetMixConstants(OOPlanetTextureGeneratorInfo *info, float temperatur
|
||||
_cacheKey = [cacheKey copy];
|
||||
_seed = seed;
|
||||
_parent = [parent retain];
|
||||
_enqueued = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -1286,10 +1308,17 @@ static void SetMixConstants(OOPlanetTextureGeneratorInfo *info, float temperatur
|
||||
|
||||
- (BOOL) enqueue
|
||||
{
|
||||
_enqueued = YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) enqueued
|
||||
{
|
||||
return _enqueued;
|
||||
}
|
||||
|
||||
|
||||
- (void) loadTexture
|
||||
{
|
||||
// Do nothing.
|
||||
|
@ -169,6 +169,8 @@ typedef OOPixMapFormat OOTextureDataFormat;
|
||||
*/
|
||||
+ (id) textureWithGenerator:(OOTextureGenerator *)generator;
|
||||
|
||||
// Load a texture from a generator with option to force an enqueue
|
||||
+ (id) textureWithGenerator:(OOTextureGenerator *)generator enqueue:(BOOL) enqueue;
|
||||
|
||||
/* Bind the texture to the current texture unit.
|
||||
This will block until loading is completed.
|
||||
|
@ -215,12 +215,18 @@ static NSString *sGlobalTraceContext = nil;
|
||||
|
||||
|
||||
+ (id) textureWithGenerator:(OOTextureGenerator *)generator
|
||||
{
|
||||
return [self textureWithGenerator:generator enqueue: NO];
|
||||
}
|
||||
|
||||
|
||||
+ (id) textureWithGenerator:(OOTextureGenerator *)generator enqueue:(BOOL) enqueue
|
||||
{
|
||||
if (generator == nil) return nil;
|
||||
|
||||
#ifndef OOTEXTURE_NO_CACHE
|
||||
OOTexture *existing = [OOTexture existingTextureForKey:[generator cacheKey]];
|
||||
if (existing != nil) return [[existing retain] autorelease];
|
||||
if (existing != nil && !enqueue) return [[existing retain] autorelease];
|
||||
#endif
|
||||
|
||||
if (![generator enqueue])
|
||||
|
@ -270,7 +270,7 @@ extern int debug;
|
||||
- (BOOL) isAlphabetKeyDown;
|
||||
- (void) supressKeysUntilKeyUp; // DJS
|
||||
- (BOOL) isDown: (int) key;
|
||||
- (BOOL) isOptDown;
|
||||
- (BOOL) isOptDown; // opt == alt key
|
||||
- (BOOL) isCtrlDown;
|
||||
- (BOOL) isCommandDown;
|
||||
- (BOOL) isShiftDown;
|
||||
|
@ -1836,6 +1836,11 @@ if (shift) { keys[a] = YES; keys[b] = NO; } else { keys[a] = NO; keys[b] = YES;
|
||||
case SDLK_RCTRL:
|
||||
ctrl = YES;
|
||||
break;
|
||||
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
opt = YES;
|
||||
break;
|
||||
|
||||
case SDLK_F12:
|
||||
[self toggleScreenMode];
|
||||
@ -2021,6 +2026,11 @@ keys[a] = NO; keys[b] = NO; \
|
||||
case SDLK_RCTRL:
|
||||
ctrl = NO;
|
||||
break;
|
||||
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
opt = NO;
|
||||
break;
|
||||
|
||||
case SDLK_ESCAPE:
|
||||
keys[27] = NO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user