Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/Core/Entities/PlayerEntity.m
Original file line number Diff line number Diff line change
Expand Up @@ -8876,7 +8876,9 @@ - (void) setGuiToGameOptionsScreen

[[UNIVERSE gameView] clearMouse];
[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];


gui_screen = GUI_SCREEN_GAMEOPTIONS;

// GUI stuff
{
#define OO_SETACCESSCONDITIONFORROW(condition, row) \
Expand Down Expand Up @@ -9138,9 +9140,6 @@ - (void) setGuiToGameOptionsScreen
}
/* ends */

[self setShowDemoShips:NO];
gui_screen = GUI_SCREEN_GAMEOPTIONS;

[self setShowDemoShips:NO];
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
}
Expand All @@ -9155,6 +9154,8 @@ - (void) setGuiToLoadSaveScreen

[[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];

gui_screen = GUI_SCREEN_OPTIONS;

if ([self status] == STATUS_DOCKED)
{
if ([self dockedStation] == nil) [self setDockedAtMainStation];
Expand Down Expand Up @@ -9232,7 +9233,6 @@ - (void) setGuiToLoadSaveScreen
[[UNIVERSE gameView] clearMouse];

[self setShowDemoShips:NO];
gui_screen = GUI_SCREEN_OPTIONS;

[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];

Expand Down Expand Up @@ -9439,6 +9439,8 @@ - (void) setGuiToEquipShipScreen:(int)skipParam selectingFacingFor:(NSString *)e
BOOL weaponMounted = NO;
BOOL guiChanged = (gui_screen != GUI_SCREEN_EQUIP_SHIP);

gui_screen = GUI_SCREEN_EQUIP_SHIP;

[gui clearAndKeepBackground:!guiChanged];
[gui setTitle:DESC(@"equip-title")];

Expand Down Expand Up @@ -9684,8 +9686,6 @@ - (void) setGuiToEquipShipScreen:(int)skipParam selectingFacingFor:(NSString *)e
/* ends */

chosen_weapon_facing = WEAPON_FACING_NONE;
[self setShowDemoShips:NO];
gui_screen = GUI_SCREEN_EQUIP_SHIP;

[self setShowDemoShips:NO];
[UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
Expand Down Expand Up @@ -9752,7 +9752,9 @@ - (void) setGuiToInterfacesScreen:(int)skip
NSDictionary *interfaces = [[self dockedStation] localInterfaces];
NSArray *interfaceKeys = [interfaces keysSortedByValueUsingSelector:@selector(interfaceCompare:)]; // sorts by category, then title
int i;


OOGUIScreenID oldScreen = gui_screen;

// GUI stuff
{
GuiDisplayGen *gui = [UNIVERSE gui];
Expand All @@ -9763,6 +9765,7 @@ - (void) setGuiToInterfacesScreen:(int)skip
[gui clearAndKeepBackground:!guiChanged];
[gui setTitle:DESC(@"interfaces-title")];

gui_screen = GUI_SCREEN_INTERFACES;

OOGUITabSettings tab_stops;
tab_stops[0] = 0;
Expand Down Expand Up @@ -9853,11 +9856,8 @@ - (void) setGuiToInterfacesScreen:(int)skip
}
/* ends */


[self setShowDemoShips:NO];

OOGUIScreenID oldScreen = gui_screen;
gui_screen = GUI_SCREEN_INTERFACES;
[self noteGUIDidChangeFrom:oldScreen to:gui_screen];

[self setShowDemoShips:NO];
Expand Down
19 changes: 16 additions & 3 deletions src/Core/Entities/PlayerEntityControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
static BOOL switching_status_screens;
//static BOOL switching_market_screens;
static BOOL switching_equipship_screens;
static BOOL switching_interface_screens;
static BOOL zoom_pressed;
static BOOL customView_pressed;
static BOOL weaponsOnlineToggle_pressed;
Expand Down Expand Up @@ -754,7 +755,7 @@ - (BOOL) handleGUIUpDownArrowKeys
{
if ([gui setLastSelectableRow]) result = YES;
}

if (result && [gui selectableRange].length > 1) [self playMenuNavigationUp];
else [self playMenuNavigationNot];

Expand Down Expand Up @@ -4673,12 +4674,14 @@ - (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias
if (gui_screen != GUI_SCREEN_MARKET)
{
[gameView clearKeys];
[gui setNoSelectedRow];
[self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
[self setGuiToMarketScreen];
}
else
{
[gameView clearKeys];
[gui setNoSelectedRow];
[self noteGUIWillChangeTo:GUI_SCREEN_MARKETINFO];
[self setGuiToMarketInfoScreen];
}
Expand All @@ -4704,6 +4707,7 @@ - (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias
{
[gameView clearKeys];
[self noteGUIWillChangeTo:GUI_SCREEN_SHIPYARD];
[gui setNoSelectedRow];
[self setGuiToShipyardScreen:0];
[gui setSelectedRow:GUI_ROW_SHIPYARD_START];
[self showShipyardInfoForSelection];
Expand All @@ -4712,6 +4716,7 @@ - (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias
{
[gameView clearKeys];
[self noteGUIWillChangeTo:GUI_SCREEN_EQUIP_SHIP];
[gui setNoSelectedRow];
[self setGuiToEquipShipScreen:0];
[gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
}
Expand All @@ -4727,8 +4732,16 @@ - (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias

if ([self checkKeyPress:n_key_gui_screen_interfaces fKey_only:!fKeyAlias])
{
[self setGuiToInterfacesScreen:0];
[gui setSelectedRow:GUI_ROW_INTERFACES_START];
if (!switching_interface_screens) {
[gui setNoSelectedRow];
[self setGuiToInterfacesScreen:0];
[gui setSelectedRow:GUI_ROW_INTERFACES_START];
}
switching_interface_screens = YES;
}
else
{
switching_interface_screens = NO;
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Entities/PlayerEntityLoadSave.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ - (void) setGuiToScenarioScreen:(int)page
++row;
}

gui_screen = GUI_SCREEN_NEWGAME;

[gui setSelectableRange:NSMakeRange(start_row - 2,3 + row - start_row)];
[gui setSelectedRow:start_row];
[self showScenarioDetails];

gui_screen = GUI_SCREEN_NEWGAME;

if (guiChanged)
{
Expand Down
1 change: 1 addition & 0 deletions src/Core/GuiDisplayGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ typedef OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS];
- (void) setNoSelectedRow;
- (NSString *) selectedRowText;
- (NSString *) selectedRowKey;
- (void) reportSelectedRow:(int) row;

- (void) setShowTextCursor:(BOOL) yesno;
- (void) setCurrentRow:(OOGUIRow) value;
Expand Down
14 changes: 13 additions & 1 deletion src/Core/GuiDisplayGen.m
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,16 @@ - (OOGUIRow) selectedRow

- (BOOL) setSelectedRow:(OOGUIRow)row
{
if ((row == selectedRow)&&RowInRange(row, selectableRange))
if ((row == selectedRow) && RowInRange(row, selectableRange))
{
return YES;
}
if (RowInRange(row, selectableRange))
{
if (![[rowKey objectAtIndex:row] isEqual:GUI_KEY_SKIP])
{
selectedRow = row;
[self reportSelectedRow:row];
return YES;
}
}
Expand All @@ -519,6 +522,7 @@ - (BOOL) setNextRow:(int) direction
if (![[rowKey objectAtIndex:row] isEqual:GUI_KEY_SKIP])
{
selectedRow = row;
[self reportSelectedRow:row];
return YES;
}
row += direction;
Expand All @@ -535,6 +539,7 @@ - (BOOL) setFirstSelectableRow
if (![[rowKey objectAtIndex:row] isEqual:GUI_KEY_SKIP])
{
selectedRow = row;
[self reportSelectedRow:row];
return YES;
}
row++;
Expand All @@ -552,6 +557,7 @@ - (BOOL) setLastSelectableRow
if (![[rowKey objectAtIndex:row] isEqual:GUI_KEY_SKIP])
{
selectedRow = row;
[self reportSelectedRow:row];
return YES;
}
row--;
Expand All @@ -561,6 +567,12 @@ - (BOOL) setLastSelectableRow
}


- (void) reportSelectedRow:(int) row
{
[PLAYER doScriptEvent:OOJSID("guiSelectedRowChanged") withArguments:[NSArray arrayWithObjects:[self keyForRow:row], [NSNumber numberWithInt:row], [self selectedRowText], nil]];
}


- (void) setNoSelectedRow
{
selectedRow = -1;
Expand Down
Loading