From ae5641ba7205bb6357b74783b2a3481281338256 Mon Sep 17 00:00:00 2001 From: AnotherCommander Date: Sun, 12 Apr 2015 12:34:02 +0200 Subject: [PATCH] Renamed - (void) setFov:(float)value fromRadians:(BOOL)fromRadians to - (void) setFov:(float)value fromRadians:(BOOL)fromFraction and - (float) fov:(BOOL)inRadians to - (float) fov:(BOOL)inFraction. --- src/Cocoa/MyOpenGLView.h | 4 ++-- src/Cocoa/MyOpenGLView.m | 8 ++++---- src/Core/Entities/PlayerEntity.m | 2 +- src/Core/Entities/PlayerEntityControls.m | 2 +- src/Core/Universe.m | 4 ++-- src/SDL/MyOpenGLView.h | 4 ++-- src/SDL/MyOpenGLView.m | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Cocoa/MyOpenGLView.h b/src/Cocoa/MyOpenGLView.h index bbd31df9..f2befb25 100644 --- a/src/Cocoa/MyOpenGLView.h +++ b/src/Cocoa/MyOpenGLView.h @@ -243,7 +243,7 @@ extern int debug; - (void) setGammaValue: (float) value; - (float) gammaValue; -- (void) setFov:(float)value fromRadians:(BOOL)fromRadians; -- (float) fov:(BOOL)inRadians; +- (void) setFov:(float)value fromFraction:(BOOL)fromFraction; +- (float) fov:(BOOL)inFraction; @end diff --git a/src/Cocoa/MyOpenGLView.m b/src/Cocoa/MyOpenGLView.m index 10d77111..1fbf6239 100644 --- a/src/Cocoa/MyOpenGLView.m +++ b/src/Cocoa/MyOpenGLView.m @@ -1227,15 +1227,15 @@ static void UnapplyCursorState(OOMouseInteractionMode mode) } -- (void) setFov:(float)value fromRadians:(BOOL)fromRadians +- (void) setFov:(float)value fromFraction:(BOOL)fromFraction { - _fov = fromRadians ? value : tan((value / 2) * M_PI / 180); + _fov = fromFraction ? value : tan((value / 2) * M_PI / 180); } -- (float) fov:(BOOL)inRadians +- (float) fov:(BOOL)inFraction { - return inRadians ? _fov : 2 * atan(_fov) * 180 / M_PI; + return inFraction ? _fov : 2 * atan(_fov) * 180 / M_PI; } @end diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index 5ee65c53..8c080c6f 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -2828,7 +2828,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market); [hud setScannerZoom:z1]; } - [[UNIVERSE gameView] setFov:fieldOfView fromRadians:YES]; + [[UNIVERSE gameView] setFov:fieldOfView fromFraction:YES]; // scanner sanity check - lose any targets further than maximum scanner range ShipEntity *primeTarget = [self primaryTarget]; diff --git a/src/Core/Entities/PlayerEntityControls.m b/src/Core/Entities/PlayerEntityControls.m index a74ed234..1dd82791 100644 --- a/src/Core/Entities/PlayerEntityControls.m +++ b/src/Core/Entities/PlayerEntityControls.m @@ -3113,7 +3113,7 @@ static NSTimeInterval time_last_frame; fovStep : 0.0f) - ((leftKeyDown && (fov > MIN_FOV_DEG)) ? fovStep : 0.0f)); if (fov > MAX_FOV_DEG) fov = MAX_FOV_DEG; if (fov < MIN_FOV_DEG) fov = MIN_FOV_DEG; - [gameView setFov:fov fromRadians:NO]; + [gameView setFov:fov fromFraction:NO]; fieldOfView = [gameView fov:YES]; int fovTicks = (int)((fov - MIN_FOV_DEG) / fovStep); NSString* fovWordDesc = DESC(@"gameoptions-fov-value"); diff --git a/src/Core/Universe.m b/src/Core/Universe.m index fcab5a21..0142d97c 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -306,8 +306,8 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV wireframeGraphics = [prefs oo_boolForKey:@"wireframe-graphics" defaultValue:NO]; doProcedurallyTexturedPlanets = [prefs oo_boolForKey:@"procedurally-textured-planets" defaultValue:YES]; [inGameView setGammaValue:[prefs oo_floatForKey:@"gamma-value" defaultValue:1.0f]]; - [inGameView setFov:OOClamp_0_max_f([prefs oo_floatForKey:@"fov-value" defaultValue:57.2f], MAX_FOV_DEG) fromRadians:NO]; - if ([inGameView fov:NO] < MIN_FOV_DEG) [inGameView setFov:MIN_FOV_DEG fromRadians:NO]; + [inGameView setFov:OOClamp_0_max_f([prefs oo_floatForKey:@"fov-value" defaultValue:57.2f], MAX_FOV_DEG) fromFraction:NO]; + if ([inGameView fov:NO] < MIN_FOV_DEG) [inGameView setFov:MIN_FOV_DEG fromFraction:NO]; // Set up speech synthesizer. #if OOLITE_SPEECH_SYNTH diff --git a/src/SDL/MyOpenGLView.h b/src/SDL/MyOpenGLView.h index 19f6d154..21b026ca 100644 --- a/src/SDL/MyOpenGLView.h +++ b/src/SDL/MyOpenGLView.h @@ -285,8 +285,8 @@ extern int debug; - (void) setGammaValue: (float) value; - (float) gammaValue; -- (void) setFov:(float)value fromRadians:(BOOL)fromRadians; -- (float) fov:(BOOL)inRadians; +- (void) setFov:(float)value fromFraction:(BOOL)fromFraction; +- (float) fov:(BOOL)inFraction; // Check current state of shift key rather than relying on last event. + (BOOL)pollShiftKey; diff --git a/src/SDL/MyOpenGLView.m b/src/SDL/MyOpenGLView.m index c52df4e8..fb77ccfa 100644 --- a/src/SDL/MyOpenGLView.m +++ b/src/SDL/MyOpenGLView.m @@ -2321,15 +2321,15 @@ keys[a] = NO; keys[b] = NO; \ } -- (void) setFov:(float)value fromRadians:(BOOL)fromRadians +- (void) setFov:(float)value fromFraction:(BOOL)fromFraction { - _fov = fromRadians ? value : tan((value / 2) * M_PI / 180); + _fov = fromFraction ? value : tan((value / 2) * M_PI / 180); } -- (float) fov:(BOOL)inRadians +- (float) fov:(BOOL)inFraction { - return inRadians ? _fov : 2 * atan(_fov) * 180 / M_PI; + return inFraction ? _fov : 2 * atan(_fov) * 180 / M_PI; }