* repositioned message row, and reworked status screen. Messages now fully readable in standard Oolite.

* if a message is repeated after 6 seconds, it will now show again, otherwise it's ignored as before.
* game settings screen: mac fullscreen resolution changes are now immediate, and F12 changes in SDL give immediate feedback.
* some minor code optimisations & cosmetic changes, including a mac splashscreen string.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2275 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2009-08-04 01:46:53 +00:00
parent 900e439603
commit 187dc2687f
9 changed files with 56 additions and 69 deletions

View File

@ -809,7 +809,7 @@
"Getting display modes..." = "Getting display modes…"; // Can't be localized, OXPs aren't loaded yet
"Loading selected expansion packs..." = "Loading selected expansion packs…"; // Can't be localized, OXPs aren't loaded yet
"loading-ships" = "Loading ship data…";
"initialising-universe" = "Initialising universe…";
"Initialising universe" = "Initialising universe…";
"loading-player" = "Loading player…";
"populating-space" = "Populating space…";
"running-scripts" = "Running scripts…";

View File

@ -56,11 +56,11 @@ enum
#if OOLITE_SDL
GUI_ROW_OPTIONS_SPACER3,
GUI_ROW_OPTIONS_QUIT,
#endif
#endif
GUI_ROW_OPTIONS_END_OF_LIST,
STATUS_EQUIPMENT_FIRST_ROW = 10,
STATUS_EQUIPMENT_MAX_ROWS = 9,
STATUS_EQUIPMENT_MAX_ROWS = 8,
GUI_ROW_EQUIPMENT_START = 3,
GUI_MAX_ROWS_EQUIPMENT = 12,

View File

@ -1357,25 +1357,11 @@ static PlayerEntity *sSharedPlayer = nil;
}
// cloaking device
if ([self hasCloakingDevice])
if ([self hasCloakingDevice] && cloaking_device_active)
{
if (cloaking_device_active)
{
energy -= (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
if (energy < CLOAKING_DEVICE_MIN_ENERGY)
[self deactivateCloakingDevice];
}
// Does this have a good reason for being here? Energy should not be added if the
// cloaking device is not used - Nikos 20090407
//else
//{
// if (energy < maxEnergy)
// {
// energy += (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
// if (energy > maxEnergy)
// energy = maxEnergy;
// }
//}
energy -= (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
if (energy < CLOAKING_DEVICE_MIN_ENERGY)
[self deactivateCloakingDevice];
}
// military_jammer
@ -1467,15 +1453,15 @@ static PlayerEntity *sSharedPlayer = nil;
if ((status != STATUS_AUTOPILOT_ENGAGED)&&(status != STATUS_ESCAPE_SEQUENCE) && (status != STATUS_ENTERING_WITCHSPACE))
{
// work on the cabin temperature
ship_temperature += (float)(delta_t * flightSpeed * air_friction / [self heatInsulation]); // wind_speed
float deltaInsulation = delta_t/[self heatInsulation];
ship_temperature += (float)( flightSpeed * air_friction * deltaInsulation); // wind_speed
if (external_temp > ship_temperature)
ship_temperature += (float)((external_temp - ship_temperature) * delta_t * SHIP_INSULATION_FACTOR / [self heatInsulation]);
ship_temperature += (float)((external_temp - ship_temperature) * SHIP_INSULATION_FACTOR * deltaInsulation);
else
{
if (ship_temperature > SHIP_MIN_CABIN_TEMP)
ship_temperature += (float)((external_temp - ship_temperature) * delta_t * SHIP_COOLING_FACTOR / [self heatInsulation]);
ship_temperature += (float)((external_temp - ship_temperature) * SHIP_COOLING_FACTOR * deltaInsulation);
}
if (ship_temperature > SHIP_MAX_CABIN_TEMP)
@ -1514,6 +1500,8 @@ static PlayerEntity *sSharedPlayer = nil;
// check for mass lock
hyperspeed_locked = [self massLocked];
// check for mass lock & external temperature?
//hyperspeed_locked = flightSpeed * air_friction > 40.0f+(ship_temperature - external_temp ) * SHIP_COOLING_FACTOR || [self massLocked];
if (hyperspeed_locked)
{
@ -4369,7 +4357,7 @@ static PlayerEntity *sSharedPlayer = nil;
[self setShowDemoShips: NO];
[UNIVERSE setDisplayText: YES];
[UNIVERSE setDisplayCursor: YES];
[UNIVERSE setDisplayCursor: NO];
[UNIVERSE setViewDirection: VIEW_GUI_DISPLAY];
#if 0
@ -6228,7 +6216,8 @@ static int last_outfitting_index;
credits -= fine;
}
NSString* fined_message = [NSString stringWithFormat:DESC(@"fined-@-credits"), OOStringFromDeciCredits(fine, YES, NO)];
// one of the fined-@-credits strings includes expansion tokens
NSString* fined_message = [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(DESC(@"fined-@-credits")), OOStringFromDeciCredits(fine, YES, NO)];
[UNIVERSE addMessage:fined_message forCount:6];
ship_clock_adjust = 24 * 3600; // take up a day
if (gui_screen != GUI_SCREEN_STATUS)

View File

@ -2017,17 +2017,20 @@ static NSTimeInterval time_last_frame;
int modeHeight = [mode intForKey:kOODisplayHeight];
int modeRefresh = [mode intForKey:kOODisplayRefreshRate];
[controller setDisplayWidth:modeWidth Height:modeHeight Refresh:modeRefresh];
#if OOLITE_SDL
/* TODO: The gameView for the SDL game currently holds and
sets the actual screen resolution (controller just stores
it). This probably ought to change. */
[gameView setScreenSize: displayModeIndex];
#endif
NSString *displayModeString = [self screenModeStringForWidth:modeWidth height:modeHeight refreshRate:modeRefresh];
[self playChangedOption];
[gui setText:displayModeString forRow:GUI_ROW(GAME,DISPLAY) align:GUI_ALIGN_CENTER];
switching_resolution = YES;
#if OOLITE_HAVE_APPKIT
if ([controller inFullScreenMode]) [controller goFullscreen:(id)YES]; // changes fullscreen mode immediately
#elif OOLITE_SDL
/* TODO: The gameView for the SDL game currently holds and
sets the actual screen resolution (controller just stores
it). This probably ought to change. */
[gameView setScreenSize: displayModeIndex]; // also changes fullscreen mode immediately
#endif
}
if (switching_resolution && ![gameView isDown:gvArrowKeyRight] && ![gameView isDown:gvArrowKeyLeft] && !selectKeyPress)
{

View File

@ -219,7 +219,7 @@ static GameController *sSharedController = nil;
}
// moved here to try to avoid initialising this before having an Open GL context
[self logProgress:DESC(@"initialising-universe")];
[self logProgress:DESC(@"Initialising universe")];
[[Universe alloc] initWithGameView:gameView];
[self logProgress:DESC(@"loading-player")];

View File

@ -41,9 +41,6 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
@interface GuiDisplayGen (Internal)
- (int) drawGUI:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha drawCursor:(BOOL) drawCursor;
- (void) drawGUI:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha;
- (void) drawGLDisplay:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha;
- (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha;
@ -613,8 +610,6 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
[self setColor:text_color forRow:row];
if (text_key)
[self setKey:text_key forRow:row];
if (text_array)
[text_array addObject:str];
rowFadeTime[row] = text_fade;
if (currentRow < (OOGUIRow)n_rows - 1)
currentRow++;
@ -791,6 +786,7 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
i = items_per_column * 2 + 2;
if (items_count > i) // don't fit in one page?
{
[UNIVERSE setDisplayCursor: YES];
i = items_per_column * 4; // total items in the first and last pages
items_per_column--; // for all the middle pages.
if (items_count <= i) // two pages
@ -857,19 +853,10 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
- (int) drawGUI:(GLfloat) alpha drawCursor:(BOOL) drawCursor
{
return [self drawGUI:drawPosition.x :drawPosition.y :[[UNIVERSE gameView] display_z] :alpha drawCursor:drawCursor];
}
- (void) drawGUI:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha
{
[self drawGUI:x :y :z :alpha drawCursor:NO];
}
- (int) drawGUI:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha drawCursor:(BOOL) drawCursor
{
GLfloat z1 = [[UNIVERSE gameView] display_z];
GLfloat x = drawPosition.x;
GLfloat y = drawPosition.y;
GLfloat z = [[UNIVERSE gameView] display_z];
if (alpha > 0.05f)
{
@ -887,7 +874,7 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
}
if ([player guiScreen] == GUI_SCREEN_STATUS)
{
[self drawEqptList:[player equipmentList] z:z1 ];
[self drawEqptList:[player equipmentList] z:z ];
}
}
[self drawGLDisplay:x - 0.5f * size_in_pixels.width :y - 0.5f * size_in_pixels.height :z :alpha];
@ -932,10 +919,10 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
[[UNIVERSE gameView] setVirtualJoystick:cursor_x/size_in_pixels.width :-cursor_y/size_in_pixels.height];
glBegin(GL_LINES);
glVertex3f((float)cursor_x - h1, (float)cursor_y, z1); glVertex3f((float)cursor_x - h3, (float)cursor_y, z1);
glVertex3f((float)cursor_x + h1, (float)cursor_y, z1); glVertex3f((float)cursor_x + h3, (float)cursor_y, z1);
glVertex3f((float)cursor_x, (float)cursor_y - h1, z1); glVertex3f((float)cursor_x, (float)cursor_y - h3, z1);
glVertex3f((float)cursor_x, (float)cursor_y + h1, z1); glVertex3f((float)cursor_x, (float)cursor_y + h3, z1);
glVertex3f((float)cursor_x - h1, (float)cursor_y, z); glVertex3f((float)cursor_x - h3, (float)cursor_y, z);
glVertex3f((float)cursor_x + h1, (float)cursor_y, z); glVertex3f((float)cursor_x + h3, (float)cursor_y, z);
glVertex3f((float)cursor_x, (float)cursor_y - h1, z); glVertex3f((float)cursor_x, (float)cursor_y - h3, z);
glVertex3f((float)cursor_x, (float)cursor_y + h1, z); glVertex3f((float)cursor_x, (float)cursor_y + h3, z);
glEnd();
glLineWidth(1.0f);

View File

@ -168,6 +168,7 @@ enum
GLfloat skyClearColor[4];
NSString *currentMessage;
OOTimeAbsolute messageRepeatTime;
GuiDisplayGen *gui;
GuiDisplayGen *message_gui;

View File

@ -175,7 +175,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
autoSave = [prefs boolForKey:@"autosave" defaultValue:NO];
wireframeGraphics = [prefs boolForKey:@"wireframe-graphics" defaultValue:NO];
#ifdef ALLOW_PROCEDURAL_PLANETS
doProcedurallyTexturedPlanets = [prefs boolForKey:@"procedurally-textured-planets" defaultValue:NO];
doProcedurallyTexturedPlanets = [prefs boolForKey:@"procedurally-textured-planets" defaultValue:YES];
#endif
shaderEffectsLevel = SHADERS_SIMPLE;
[self setShaderEffectsLevel:[prefs intForKey:@"shader-effects-level" defaultValue:shaderEffectsLevel]];
@ -220,11 +220,11 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
message_gui = [[GuiDisplayGen alloc]
initWithPixelSize:NSMakeSize(480, 160)
columns:1
rows:8
rowHeight:20
rows:9
rowHeight:19
rowStart:20
title:nil];
[message_gui setCurrentRow:7];
[message_gui setCurrentRow:8];
[message_gui setCharacterSize:NSMakeSize(16,20)]; // slightly narrower characters
[message_gui setDrawPosition: make_vector(0.0, -40.0, 640.0)];
[message_gui setAlpha:1.0];
@ -459,11 +459,11 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
message_gui = [[GuiDisplayGen alloc]
initWithPixelSize:NSMakeSize(480, 160)
columns:1
rows:8
rowHeight:20
rows:9
rowHeight:19
rowStart:20
title:nil];
[message_gui setCurrentRow:7];
[message_gui setCurrentRow:8];
[message_gui setCharacterSize:NSMakeSize(16,20)]; // slightly narrower characters
[message_gui setDrawPosition: make_vector(0.0, -40.0, 640.0)];
[message_gui setAlpha:1.0];
@ -486,6 +486,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
time_delta = 0.0;
time_acceleration_factor = TIME_ACCELERATION_FACTOR_DEFAULT;
universal_time = 0.0;
messageRepeatTime = 0.0;
[commodityLists autorelease];
commodityLists = [[ResourceManager dictionaryFromFilesNamed:@"commodities.plist" inFolder:@"Config" andMerge:YES] retain];
@ -5140,11 +5141,11 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
- (void) displayMessage:(NSString *) text forCount:(OOTimeDelta)count
{
if (![currentMessage isEqual:text])
if (![currentMessage isEqual:text] || universal_time >= messageRepeatTime)
{
if (currentMessage) [currentMessage release];
currentMessage = [text retain];
messageRepeatTime=universal_time + 6.0;
[message_gui printLongText:text align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:count key:nil addToArray:nil];
}
}
@ -5186,7 +5187,7 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
- (void) addMessage:(NSString *)text forCount:(OOTimeDelta)count
{
if (![currentMessage isEqual:text])
if (![currentMessage isEqual:text] || universal_time >= messageRepeatTime)
{
#if OOLITE_SPEECH_SYNTH
PlayerEntity* player = [PlayerEntity sharedPlayer];
@ -5235,6 +5236,7 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
[currentMessage release];
currentMessage = [text retain];
messageRepeatTime=universal_time + 6.0;
}
}
@ -5243,7 +5245,7 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
{
if ([[PlayerEntity sharedPlayer] showDemoShips]) return;
if (![currentMessage isEqualToString:text])
if (![currentMessage isEqualToString:text] || universal_time >= messageRepeatTime)
{
PlayerEntity* player = [PlayerEntity sharedPlayer];
@ -5262,6 +5264,7 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
[currentMessage release];
currentMessage = [text retain];
messageRepeatTime=universal_time + 6.0;
}
}

View File

@ -1252,12 +1252,16 @@ if (shift) { keys[a] = YES; keys[b] = NO; } else { keys[a] = NO; keys[b] = YES;
//refresh to display current fullscreen res
[[PlayerEntity sharedPlayer] setGuiToGameOptionsScreen];
}
}
break;
case SDLK_F12:
[self toggleScreenMode];
if([[PlayerEntity sharedPlayer] guiScreen]==GUI_SCREEN_GAMEOPTIONS)
{
//refresh play windowed / full screen
[[PlayerEntity sharedPlayer] setGuiToGameOptionsScreen];
}
break;
case SDLK_ESCAPE: