- Added yet another strict/unrestricted difference (idea mentioned a few months ago IIRC): after game over, restricted mode always restarts with a Jameson. Unrestricted mode still uses the last save game in the current session.

- HUD: temperature bars are now drawn marginally faster, minor code cleanup. (& inadvertently cleaned up all tabs/spaces...)

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3128 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2010-04-06 14:25:49 +00:00
parent 32f250e957
commit 1abbce6fc4
2 changed files with 92 additions and 75 deletions

View File

@ -229,7 +229,6 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
[legendArray release];
[dialArray release];
[hudName release];
[super dealloc];
}
@ -829,7 +828,6 @@ static BOOL hostiles;
}
}
if (ms_blip > 0.0)
{
DrawSpecialOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(16.0 * (1.0 - ms_blip), 8.0 * (1.0 - ms_blip)), 30, col);
@ -874,7 +872,6 @@ static BOOL hostiles;
for (i = 0; i < ent_count; i++)
[my_entities[i] release]; // released
}
@ -1060,7 +1057,6 @@ static BOOL hostiles;
case COMPASS_MODE_BASIC:
[self drawCompassPlanetBlipAt:relativePosition Size:NSMakeSize(6, 6) Alpha:alpha];
break;
case COMPASS_MODE_PLANET:
[self drawCompassPlanetBlipAt:relativePosition Size:sz Alpha:alpha];
break;
@ -1286,10 +1282,11 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
hudDrawSurroundAt(x, y, z1, siz);
}
// draw speed bar
if (ds > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
if (ds > .80)
GLColorWithOverallAlpha(red_color, alpha);
else if (ds > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
hudDrawBarAt(x, y, z1, siz, ds);
}
@ -1585,14 +1582,22 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
double temp = [player hullHeatLevel];
int flash = (int)([UNIVERSE getTime] * 4);
flash &= 1;
// draw ship_temperature bar
GLColorWithOverallAlpha(green_color, alpha);
if (temp > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
// draw ship_temperature bar (only need to call GLColor() once!)
if (temp > .80)
GLColorWithOverallAlpha(red_color, alpha);
if ((flash)&&(temp > .90))
GLColorWithOverallAlpha(redplus_color, alpha);
{
if (temp > .90 && flash)
GLColorWithOverallAlpha(redplus_color, alpha);
else
GLColorWithOverallAlpha(red_color, alpha);
}
else
{
if (temp > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
else
GLColorWithOverallAlpha(green_color, alpha);
}
[player setAlertFlag:ALERT_FLAG_TEMP to:((temp > .90)&&([player status] == STATUS_IN_FLIGHT))];
hudDrawBarAt(x, y, z1, siz, temp);
}
@ -1617,12 +1622,13 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
alpha *= [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f];
double temp = [player laserHeatLevel];
// draw weapon_temp bar
GLColorWithOverallAlpha(green_color, alpha);
if (temp > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
// draw weapon_temp bar (only need to call GLColor() once!)
if (temp > .80)
GLColorWithOverallAlpha(red_color, alpha);
else if (temp > .25)
GLColorWithOverallAlpha(yellow_color, alpha);
else
GLColorWithOverallAlpha(green_color, alpha);
hudDrawBarAt(x, y, z1, siz, temp);
}
@ -1649,11 +1655,21 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
int flash = (int)([UNIVERSE getTime] * 4);
flash &= 1;
// draw altitude bar
if ((flash)&&(alt < .10)) GLColorWithOverallAlpha(redplus_color, alpha);
else if (alt < .25) GLColorWithOverallAlpha(red_color, alpha);
else if (alt < .75) GLColorWithOverallAlpha(yellow_color, alpha);
else GLColorWithOverallAlpha(green_color, alpha);
// draw altitude bar (evaluating the least amount of ifs per go)
if (alt < .25)
{
if (alt < .10 && flash)
GLColorWithOverallAlpha(redplus_color, alpha);
else
GLColorWithOverallAlpha(red_color, alpha);
}
else
{
if (alt < .75)
GLColorWithOverallAlpha(yellow_color, alpha);
else
GLColorWithOverallAlpha(green_color, alpha);
}
hudDrawBarAt(x, y, z1, siz, alt);
@ -2348,7 +2364,7 @@ static OOPolygonSprite *IconForMissileRole(NSString *role)
OOGL(glColor4f(0.0, 1.0, 0.0, 1.0));
// position the watermark string on the top right hand corner of the game window and right-align it
OODrawString(watermarkString, MAIN_GUI_PIXEL_WIDTH / 2 - watermarkStringSize.width + 80,
MAIN_GUI_PIXEL_HEIGHT / 2 - watermarkStringSize.height, z1, NSMakeSize(10,10));
MAIN_GUI_PIXEL_HEIGHT / 2 - watermarkStringSize.height, z1, NSMakeSize(10,10));
}
//---------------------------------------------------------------------//

View File

@ -2721,8 +2721,9 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
- (void) game_over
{
if ([[gameView gameController] playerFileToLoad]) [[gameView gameController] loadPlayerIfRequired];
else [self reinitAndShowDemo:NO];
// In unrestricted mode, reload last save game, if any. In strict mode, always restart as a fresh Jameson.
if (![self strict] && [[gameView gameController] playerFileToLoad]) [[gameView gameController] loadPlayerIfRequired];
else [self reinitAndShowDemo:NO];
}