Add text entry onto chart
This commit is contained in:
parent
0e854500b5
commit
0170ad401b
@ -148,7 +148,8 @@ enum
|
||||
GUI_ROW_SCENARIOS_START = 3,
|
||||
GUI_MAX_ROWS_SCENARIOS = 12,
|
||||
GUI_ROW_SCENARIOS_DETAIL = GUI_ROW_SCENARIOS_START + GUI_MAX_ROWS_SCENARIOS + 2,
|
||||
GUI_ROW_CHART_SYSTEM = 18
|
||||
GUI_ROW_CHART_SYSTEM = 18,
|
||||
GUI_ROW_PLANET_FINDER = 19
|
||||
};
|
||||
#if GUI_FIRST_ROW() < 0
|
||||
# error Too many items in OPTIONS list!
|
||||
@ -234,6 +235,12 @@ typedef enum
|
||||
PLAYER_FLEEING_LIKELY = 3
|
||||
} OOPlayerFleeingStatus;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CHART_MODE_SHORT_RANGE,
|
||||
CHART_MODE_LONG_RANGE
|
||||
} OOChartMode;
|
||||
|
||||
|
||||
#define ECM_ENERGY_DRAIN_FACTOR 20.0f
|
||||
#define ECM_DURATION 2.5f
|
||||
@ -417,6 +424,7 @@ typedef enum
|
||||
// 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;
|
||||
OOChartMode chart_mode;
|
||||
OOTimeDelta witchspaceCountdown;
|
||||
|
||||
// player commander data
|
||||
|
@ -567,6 +567,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
|
||||
- (OOScalar) chart_zoom
|
||||
{
|
||||
if (chart_mode == CHART_MODE_LONG_RANGE) return CHART_MAX_ZOOM;
|
||||
return chart_zoom;
|
||||
}
|
||||
|
||||
@ -951,6 +952,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
chart_centre_coordinates = galaxy_coordinates;
|
||||
cursor_coordinates = galaxy_coordinates;
|
||||
chart_zoom = 1.0;
|
||||
chart_mode = CHART_MODE_SHORT_RANGE;
|
||||
|
||||
NSString *keyStringValue = [dict oo_stringForKey:@"target_coordinates"];
|
||||
if (keyStringValue != nil)
|
||||
@ -1724,6 +1726,8 @@ static GLfloat sBaseMass = 0.0;
|
||||
chart_centre_coordinates = galaxy_coordinates;
|
||||
cursor_coordinates = galaxy_coordinates;
|
||||
chart_zoom = 1.0;
|
||||
chart_mode = CHART_MODE_SHORT_RANGE;
|
||||
|
||||
|
||||
scripted_misjump = NO;
|
||||
_scriptedMisjumpRange = 0.5;
|
||||
@ -7571,14 +7575,33 @@ static GLfloat sBaseMass = 0.0;
|
||||
// GUI stuff
|
||||
{
|
||||
[gui clearAndKeepBackground:!guiChanged];
|
||||
[gui setTitle:DESC(@"short-range-chart-title")];
|
||||
NSString *gal_key = [NSString stringWithFormat:@"long-range-chart-title-%d", galaxy_number];
|
||||
if ([[UNIVERSE descriptions] valueForKey:gal_key] == nil)
|
||||
{
|
||||
[gui setTitle:[NSString stringWithFormat:DESC(@"long-range-chart-title-d"), galaxy_number+1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui setTitle:[UNIVERSE descriptionForKey:gal_key]];
|
||||
}
|
||||
// refresh the short range chart cache, in case we've just loaded a save game with different local overrides, etc.
|
||||
[gui refreshStarChart];
|
||||
//[gui setText:targetSystemName forRow:19];
|
||||
// distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
|
||||
//[gui setText:[NSString stringWithFormat:OOExpandKey(@"short-range-chart-distance-f"), distance] forRow:20];
|
||||
//if ([self hasHyperspaceMotor]) [gui setText:(NSString *)((distance > 0.0 && distance <= (double)fuel/10.0) ? (NSString *)[NSString stringWithFormat:OOExpandKey(@"short-range-chart-est-travel-time-f"), estimatedTravelTime] : (NSString *)@"") forRow:21];
|
||||
[gui setShowTextCursor:NO];
|
||||
if (chart_mode == CHART_MODE_LONG_RANGE)
|
||||
{
|
||||
NSString *displaySearchString = planetSearchString ? [planetSearchString capitalizedString] : (NSString *)@"";
|
||||
[gui setText:[NSString stringWithFormat:DESC(@"long-range-chart-find-planet-@"), displaySearchString] forRow:GUI_ROW_PLANET_FINDER];
|
||||
[gui setColor:[OOColor cyanColor] forRow:GUI_ROW_PLANET_FINDER];
|
||||
[gui setShowTextCursor:YES];
|
||||
[gui setCurrentRow:GUI_ROW_PLANET_FINDER];
|
||||
}
|
||||
else
|
||||
{
|
||||
[gui setShowTextCursor:NO];
|
||||
}
|
||||
}
|
||||
/* ends */
|
||||
|
||||
|
@ -577,7 +577,7 @@ static NSTimeInterval time_last_frame;
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
GameController *gameController = [UNIVERSE gameController];
|
||||
|
||||
BOOL onTextEntryScreen = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) || (gui_screen == GUI_SCREEN_MISSION) || (gui_screen == GUI_SCREEN_SAVE);
|
||||
BOOL onTextEntryScreen = (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART && chart_mode == CHART_MODE_LONG_RANGE) || (gui_screen == GUI_SCREEN_MISSION) || (gui_screen == GUI_SCREEN_SAVE);
|
||||
|
||||
@try
|
||||
{
|
||||
@ -1580,13 +1580,13 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
BOOL moving = NO;
|
||||
double cursor_speed = [gameView isCtrlDown] ? 20.0 : 10.0;
|
||||
double cursor_speed = ([gameView isCtrlDown] ? 20.0 : 10.0)* [self chart_zoom];
|
||||
GameController *controller = [UNIVERSE gameController];
|
||||
GuiDisplayGen *gui = [UNIVERSE gui];
|
||||
GUI_ROW_INIT(gui);
|
||||
|
||||
// deal with string inputs as necessary
|
||||
if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
|
||||
if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART && chart_mode == CHART_MODE_LONG_RANGE)
|
||||
{
|
||||
[gameView setStringInput: gvStringInputAlpha];
|
||||
}
|
||||
@ -1605,8 +1605,8 @@ static NSTimeInterval time_last_frame;
|
||||
|
||||
switch (gui_screen)
|
||||
{
|
||||
case GUI_SCREEN_SHORT_RANGE_CHART:
|
||||
case GUI_SCREEN_LONG_RANGE_CHART:
|
||||
cursor_speed *= 2.0;
|
||||
|
||||
if ([self status] != STATUS_WITCHSPACE_COUNTDOWN)
|
||||
{
|
||||
@ -1642,7 +1642,6 @@ static NSTimeInterval time_last_frame;
|
||||
moving |= (searchStringLength != [[gameView typedString] length]);
|
||||
searchStringLength = [[gameView typedString] length];
|
||||
}
|
||||
case GUI_SCREEN_SHORT_RANGE_CHART:
|
||||
if ([gameView isDown:key_advanced_nav_array]) // '^' key
|
||||
{
|
||||
if (!pling_pressed)
|
||||
@ -1680,8 +1679,6 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
queryPressed = NO;
|
||||
}
|
||||
|
||||
if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART) cursor_speed *= chart_zoom;
|
||||
|
||||
show_info_flag = ([gameView isDown:key_map_info]);
|
||||
|
||||
@ -3266,10 +3263,18 @@ static NSTimeInterval time_last_frame;
|
||||
if (!switching_chart_screens)
|
||||
{
|
||||
switching_chart_screens = YES;
|
||||
if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART || (gui_screen == GUI_SCREEN_SYSTEM_DATA && showingLongRangeChart))
|
||||
[self setGuiToLongRangeChartScreen];
|
||||
else
|
||||
[self setGuiToShortRangeChartScreen];
|
||||
if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART)
|
||||
{
|
||||
if (chart_mode == CHART_MODE_LONG_RANGE)
|
||||
{
|
||||
chart_mode = CHART_MODE_SHORT_RANGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
chart_mode = CHART_MODE_LONG_RANGE;
|
||||
}
|
||||
}
|
||||
[self setGuiToShortRangeChartScreen];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1560,6 +1560,7 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
||||
OORouteType advancedNavArrayMode = OPTIMIZED_BY_NONE;
|
||||
BOOL routeExists = YES;
|
||||
|
||||
BOOL *systemsFound = [UNIVERSE systemsFound];
|
||||
|
||||
// get a list of systems marked as contract destinations
|
||||
NSDictionary* markedDestinations = [player markedDestinations];
|
||||
@ -1714,6 +1715,56 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
||||
GLDrawFilledOval(x + star.x, y + star.y, z, NSMakeSize(blob_size,blob_size), 15);
|
||||
}
|
||||
|
||||
// draw found stars and captions
|
||||
//
|
||||
OOGL(GLScaledLineWidth(1.5f));
|
||||
OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
|
||||
int n_matches = 0, foundIndex = -1;
|
||||
|
||||
for (i = 0; i < 256; i++) if (systemsFound[i])
|
||||
{
|
||||
if(foundSystem == n_matches) foundIndex = i;
|
||||
n_matches++;
|
||||
}
|
||||
|
||||
if (n_matches == 0)
|
||||
{
|
||||
foundSystem = 0;
|
||||
}
|
||||
else if (backgroundSpecial == GUI_BACKGROUND_SPECIAL_LONG_ANA_SHORTEST || backgroundSpecial == GUI_BACKGROUND_SPECIAL_LONG_ANA_QUICKEST || backgroundSpecial == GUI_BACKGROUND_SPECIAL_LONG)
|
||||
{
|
||||
// do nothing at this stage
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL drawNames = n_matches < 4;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
BOOL mark = systemsFound[i];
|
||||
g_seed = [UNIVERSE systemSeedForSystemNumber:i];
|
||||
if (mark)
|
||||
{
|
||||
star.x = (float)(g_seed.d * hscale + hoffset);
|
||||
star.y = (float)(g_seed.b * vscale + voffset);
|
||||
OOGLBEGIN(GL_LINE_LOOP);
|
||||
glVertex3f(x + star.x - 2.0f, y + star.y - 2.0f, z);
|
||||
glVertex3f(x + star.x + 2.0f, y + star.y - 2.0f, z);
|
||||
glVertex3f(x + star.x + 2.0f, y + star.y + 2.0f, z);
|
||||
glVertex3f(x + star.x - 2.0f, y + star.y + 2.0f, z);
|
||||
OOGLEND();
|
||||
if (i == foundIndex || n_matches == 1)
|
||||
{
|
||||
if (n_matches == 1) foundSystem = 0;
|
||||
OOGL(glColor4f(0.0f, 1.0f, 1.0f, alpha));
|
||||
OODrawString([UNIVERSE systemNameIndex:i] , x + star.x + 2.0, y + star.y - 10.0f, z, NSMakeSize(10,10));
|
||||
OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
|
||||
}
|
||||
else if (drawNames)
|
||||
OODrawString([UNIVERSE systemNameIndex:i] , x + star.x + 2.0, y + star.y - 10.0f, z, NSMakeSize(10,10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw names
|
||||
//
|
||||
OOGL(glColor4f(1.0f, 1.0f, 0.0f, alpha)); // yellow
|
||||
|
Loading…
x
Reference in New Issue
Block a user