- 3425 redux: fixed remaining bugs from that commit, hopefully found them all.

- no more distorted textures when reduced detail is on.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3431 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2010-05-29 23:51:16 +00:00
parent e12b40f5e2
commit 307e0643a7
10 changed files with 27 additions and 25 deletions

View File

@ -47,5 +47,7 @@
paused_overlay = "paused-overlay.png"; // in-flight and paused
paused_docked_overlay = "paused-docked-overlay.png";
overwrite_overlay = "overwrite-overlay.png"; // overlay used in the 'overwrite saved game?' screen
*/
}

View File

@ -5925,14 +5925,13 @@ static NSString *last_outfitting_key=nil;
[tempTexture release];
tempTexture = [[UNIVERSE screenBackgroundNameForKey:@"equip_ship"] copy];
[tempTexture retain];
//[tempTexture retain]; // unnecessary
[gui setBackgroundTextureName:tempTexture];
}
else if (eqKeyForSelectFacing != nil) // weapon purchase
{
bgName = [UNIVERSE screenBackgroundNameForKey:@"mount_weapon"];
if (bgName == nil) bgName = tempTexture;
else [gui setBackgroundTextureName:bgName];
if (bgName != nil)[gui setBackgroundTextureName:bgName];
}
else // Returning from a weapon purchase. (Also called, redundantly, when paging)
{

View File

@ -721,10 +721,11 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
if (guiChanged)
{
[gui setForegroundTextureKey:@"docked_overlay"];
[gui setForegroundTextureKey:@"docked_overlay"]; // has to be docked!
bgName = [UNIVERSE screenBackgroundNameForKey:@"contracts"];
[gui setBackgroundTextureKey:@"market"];
if (bgName == nil) bgName = [UNIVERSE screenBackgroundNameForKey:@"market"];
[gui setBackgroundTextureName:bgName];
[self noteGuiChangeFrom:oldScreen to:gui_screen];
}
}
@ -1134,7 +1135,7 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
if (guiChanged)
{
[gui setForegroundTextureKey:@"docked_overlay"];
[gui setForegroundTextureKey:@"docked_overlay"]; // has to be docked!
NSString *bgName = [UNIVERSE screenBackgroundNameForKey:@"report"];
if (bgName == nil) bgName = [UNIVERSE screenBackgroundNameForKey:@"status_docked"];
@ -1204,7 +1205,7 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
if (guiChanged)
{
[gui setForegroundTextureKey:@"docked_overlay"];
[gui setForegroundTextureKey:@"docked_overlay"]; // has to be docked!
NSString *bgName = [UNIVERSE screenBackgroundNameForKey:@"report"];
if (bgName == nil) bgName = [UNIVERSE screenBackgroundNameForKey:@"status_docked"];

View File

@ -3076,7 +3076,7 @@ static BOOL toggling_music;
[UNIVERSE setDisplayCursor:NO];
if ([UNIVERSE pauseMessageVisible])
{
[UNIVERSE clearPreviousMessage]; // remove the 'paused' message if it was there.
[UNIVERSE clearPreviousMessage]; // remove the 'paused' message.
[UNIVERSE setPauseMessageVisible:NO];
}
[[UNIVERSE gui] setForegroundTextureKey:@"docked_overlay"];

View File

@ -2098,8 +2098,8 @@ static int scriptRandomSeed = -1; // ensure proper random function
if ([value length] != 0 && ![[value lowercaseString] isEqualToString:@"none"])
{
missionBackgroundTexture = [value copy];
}
missionForegroundTexture = [value copy];
}
}
@ -2109,8 +2109,7 @@ static int scriptRandomSeed = -1; // ensure proper random function
if ([value length] != 0 && ![[value lowercaseString] isEqualToString:@"none"])
{
tempTexture = [OOTexture textureWithName:value inFolder:@"Images"];
[tempTexture retain];
tempTexture = [value copy];
}
}

View File

@ -717,7 +717,9 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
[gui setSelectableRange: NSMakeRange(SAVE_OVERWRITE_YES_ROW, 2)];
[gui setSelectedRow: SAVE_OVERWRITE_NO_ROW];
// We can only leave this screen by answering yes or no, or esc. Better not use overlays here, could be misleading.
// We can only leave this screen by answering yes or no, or esc. Therefore
// use a specific overlay, to allow visual reminders of the available options.
[gui setForegroundTextureKey:@"overwrite_overlay"];
[gui setBackgroundTextureKey:@"load_save"];
[self setShowDemoShips: NO];

View File

@ -583,7 +583,7 @@ static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context)
NSOpenGLPFAScreenMask, CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
// Specifying "NoRecovery" gives us a context that cannot fall back to the software renderer.
//This makes the View-based context a compatible with the fullscreen context, enabling us to use the "shareContext"
// This makes the View-based context compatible with the fullscreen context, enabling us to use the "shareContext"
// feature to share textures, display lists, and other OpenGL objects between the two.
NSOpenGLPFANoRecovery,

View File

@ -805,9 +805,8 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
if (foregroundTexture != nil)
{
foregroundSprite = [[OpenGLSprite alloc] initWithTexture:foregroundTexture];
return (foregroundSprite != nil);
}
return YES;
return (foregroundSprite != nil);
}
@ -851,16 +850,14 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
- (BOOL) setBackgroundTextureKey:(NSString *)key
{
NSString *name = [UNIVERSE screenBackgroundNameForKey:key];
if (name == nil) return NO;
return [self setBackgroundTextureName:name];
return [self setBackgroundTextureName:name]; // if the name is nil, we want the background cleared
}
- (BOOL) setForegroundTextureKey:(NSString *)key
{
NSString *name = [UNIVERSE screenBackgroundNameForKey:key];
if (name == nil) return NO;
return [self setForegroundTextureName:name];
return [self setForegroundTextureName:name]; // if the name is nil, we want the foreground cleared
}

View File

@ -485,10 +485,10 @@ static BOOL sHaveSetUp = NO;
desiredWidth = MIN(desiredWidth, sUserMaxSize);
desiredHeight = MIN(desiredHeight, sUserMaxSize);
if (sReducedDetail)
if (sReducedDetail && (512 < desiredWidth || 512 < desiredHeight )) // Rescale texture, keeping its proportions.
{
if (512 < desiredWidth) desiredWidth /= 2;
if (512 < desiredHeight) desiredHeight /= 2;
desiredWidth /= 2;
desiredHeight /= 2;
}
}
}

View File

@ -445,7 +445,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
if ([player status] == STATUS_DOCKED)
{
if ([gui setForegroundTextureName:@"paused_docked_overlay"])
if ([gui setForegroundTextureKey:@"paused_docked_overlay"])
{
[gui drawGUI:1.0 drawCursor:NO];
}
@ -457,8 +457,10 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
}
else
{
if ([gui setForegroundTextureName:@"paused_overlay"])
NSString *fgName = [UNIVERSE screenBackgroundNameForKey:@"paused_overlay"];
if ([player guiScreen] != GUI_SCREEN_MAIN && fgName != nil)
{
[gui setForegroundTextureName:fgName];
[gui drawGUI:1.0 drawCursor:NO];
}
else