Oolite
Loading...
Searching...
No Matches
HeadUpDisplay Class Reference

#include <HeadUpDisplay.h>

Inheritance diagram for HeadUpDisplay:
Collaboration diagram for HeadUpDisplay:

Instance Methods

(id) - initWithDictionary:
(id) - initWithDictionary:inFile:
(void) - resetGuis:
(NSString *) - hudName
(void) - setHudName:
(GLfloat) - scannerZoom
(void) - setScannerZoom:
(GLfloat) - overallAlpha
(void) - setOverallAlpha:
(BOOL) - reticleTargetSensitive
(void) - setReticleTargetSensitive:
(NSMutableDictionary *) - propertiesReticleTargetSensitive
(BOOL) - isHidden
(void) - setHidden:
(BOOL) - allowBigGui
(BOOL) - hasHidden:
(void) - setHiddenSelector:hidden:
(void) - clearHiddenSelectors
(BOOL) - isCompassActive
(void) - setCompassActive:
(BOOL) - isUpdating
(void) - setDeferredHudName:
(NSString *) - deferredHudName
(NSString *) - crosshairDefinition
(BOOL) - setCrosshairDefinition:
(void) - addLegend:
(void) - addDial:
(void) - addMFD:
(NSUInteger) - mfdCount
(void) - renderHUD
(void) - refreshLastTransmitter
(void) - setLineWidth:
(GLfloat) - lineWidth
(BOOL) - minimalisticScanner
(void) - setMinimalisticScanner:
(BOOL) - nonlinearScanner
(void) - setNonlinearScanner:
(BOOL) - scannerUltraZoom
(void) - setScannerUltraZoom:
(OOColor *) - reticleColorForIndex:
(BOOL) - setReticleColorForIndex:toColor:
(OOINLINE void) - GLColorWithOverallAlpha [implementation]
(void) - dealloc [implementation]
(void) - resetGui:withInfo: [implementation]
(void) - resetGuiPosition:withInfo: [implementation]
(void) - drawLegends [implementation]
(void) - drawDials [implementation]
(void) - drawMFDs [implementation]
(void) - drawCrosshairs [implementation]
(NSArray *) - crosshairDefinitionForWeaponType: [implementation]
(void) - drawLegend: [implementation]
(void) - drawHUDItem: [implementation]
(BOOL) - checkPlayerInFlight [implementation]
(BOOL) - checkPlayerInSystemFlight [implementation]
(void) - drawScanner: [implementation]
(void) - drawScannerZoomIndicator: [implementation]
(void) - drawCompass: [implementation]
(OOINLINE void) - SetCompassBlipColor [implementation]
(void) - drawCompassPlanetBlipAt:Size:Alpha: [implementation]
(void) - drawCompassStationBlipAt:Size:Alpha: [implementation]
(void) - drawCompassSunBlipAt:Size:Alpha: [implementation]
(void) - drawCompassTargetBlipAt:Size:Alpha: [implementation]
(void) - drawCompassBeaconBlipAt:Size:Alpha: [implementation]
(void) - drawAegis: [implementation]
(void) - drawCustomBar: [implementation]
(void) - drawCustomText: [implementation]
(void) - drawCustomIndicator: [implementation]
(void) - drawCustomLight: [implementation]
(void) - drawCustomImage: [implementation]
(void) - drawSpeedBar: [implementation]
(void) - drawRollBar: [implementation]
(void) - drawPitchBar: [implementation]
(void) - drawYawBar: [implementation]
(void) - drawEnergyGauge: [implementation]
(void) - drawForwardShieldBar: [implementation]
(void) - drawAftShieldBar: [implementation]
(void) - drawFuelBar: [implementation]
(void) - drawWitchspaceDestination: [implementation]
(void) - drawCabinTempBar: [implementation]
(void) - drawWeaponTempBar: [implementation]
(void) - drawAltitudeBar: [implementation]
(void) - drawIconForMissile:selected:status:x:y:width:height:alpha: [implementation]
(void) - drawIconForEmptyPylonAtX:y:width:height:alpha: [implementation]
(void) - drawMissileDisplay: [implementation]
(void) - drawTargetReticle: [implementation]
(void) - drawSecondaryTargetReticle: [implementation]
(void) - drawWaypoints: [implementation]
(void) - drawStatusLight: [implementation]
(void) - drawDirectionCue: [implementation]
(void) - drawClock: [implementation]
(void) - drawPrimedEquipment: [implementation]
(void) - drawASCTarget: [implementation]
(void) - drawWeaponsOfflineText: [implementation]
(void) - drawFPSInfoCounter: [implementation]
(void) - drawScoopStatus: [implementation]
(void) - drawStickSensitivityIndicator: [implementation]
(void) - drawSurroundInternal:color: [implementation]
(void) - drawSurround: [implementation]
(void) - drawGreenSurround: [implementation]
(void) - drawYellowSurround: [implementation]
(void) - drawTrumbles: [implementation]
(void) - drawMultiFunctionDisplay:withText:asIndex: [implementation]
(void) - OOHUDResetTextEngine(void) [implementation]
(NSRect) - OORectFromString [implementation]
(CGFloat) - OOStringWidthInEm [implementation]
(void) - drawHighlight [implementation]
(void) - OODrawString [implementation]
(void) - OODrawStringAligned [implementation]
(void) - OOStartDrawingStrings [implementation]
(void) - OODrawStringQuadsAligned [implementation]
(void) - OOStopDrawingStrings [implementation]
(void) - OODrawHilightedString [implementation]
(void) - OODrawPlanetInfo [implementation]
(void) - OODrawHilightedPlanetInfo [implementation]
(void) - drawPrimedEquipmentText: [implementation]

Class Methods

(Vector) + nonlinearScannerScale:Zoom:Scale:
(static GLfloat) + drawCharacterQuad [implementation]
(static void) + InitTextEngine(void) [implementation]
(static void) + prefetchData [implementation]
(static OOPolygonSprite *) + IconForMissileRole [implementation]
(static void) + hudDrawIndicatorAt [implementation]
(static void) + hudDrawMarkerAt [implementation]
(static void) + hudDrawBarAt [implementation]
(static void) + hudDrawSurroundAt [implementation]
(static void) + hudDrawStatusIconAt [implementation]
(static void) + hudDrawReticleOnTarget [implementation]
(static void) + hudDrawWaypoint [implementation]
(static void) + hudRotateViewpointForVirtualDepth [implementation]
(static void) + InitTextEngine(void) [implementation]
(static void) + GLDrawNonlinearCascadeWeapon [implementation]
(static GLfloat) + nonlinearScannerFunc [implementation]
(static void) + drawScannerGrid [implementation]
(static void) + DrawSpecialOval [implementation]

Private Attributes

NSMutableArray * legendArray
NSMutableArray * dialArray
NSMutableArray * mfdArray
GLfloat scanner_zoom
GLfloat z1
GLfloat lineWidth
NSString * hudName
NSString * deferredHudName
BOOL hudUpdating
GLfloat overallAlpha
BOOL reticleTargetSensitive
NSMutableDictionary * propertiesReticleTargetSensitive
BOOL cloakIndicatorOnStatusLight
BOOL hudHidden
BOOL allowBigGui
int last_transmitter
NSMutableSet * _hiddenSelectors
OOCrosshairs * _crosshairs
OOWeaponType _lastWeaponType
GLfloat _lastOverallAlpha
BOOL _lastWeaponsOnline
NSDictionary * _crosshairOverrides
OOColor * _crosshairColor
GLfloat _crosshairScale
GLfloat _crosshairWidth
NSString * crosshairDefinition
BOOL _compassActive
NSMutableArray * _reticleColors
BOOL minimalistic_scanner
BOOL nonlinear_scanner
BOOL scanner_ultra_zoom

Detailed Description

Definition at line 233 of file HeadUpDisplay.h.

Method Documentation

◆ addDial:

- (void) addDial: (NSDictionary*) info

Definition at line 678 of file HeadUpDisplay.m.

678 :(NSDictionary*)info
679{
680 static NSSet* allowedSelectors = nil;
681 if (allowedSelectors == nil) {
682 NSDictionary* whitelist = [ResourceManager whitelistDictionary];
683 allowedSelectors = [[NSSet alloc] initWithArray:[whitelist oo_arrayForKey:@"hud_dial_methods"]];
684 }
685
686 NSString* selectorString = [info oo_stringForKey:SELECTOR_KEY];
687 if (selectorString == nil) {
688 OOLogERR(@"hud.dial.noSelector", @"HUD dial in %@ is missing selector.", hudName);
689 return;
690 }
691
692 if (![allowedSelectors containsObject:selectorString]) {
693 OOLogERR(@"hud.dial.invalidSelector", @"HUD dial in %@ uses selector \"%@\" which is not in whitelist, and will be ignored.", hudName, selectorString);
694 return;
695 }
696
697 SEL selector = NSSelectorFromString(selectorString);
698
699 NSAssert2([self respondsToSelector:selector], @"HUD dial in %@ uses selector \"%@\" which is in whitelist, but not implemented.", hudName, selectorString);
700
701 // handle the case above with NS_BLOCK_ASSERTIONS too.
702 if (![self respondsToSelector:selector]) {
703 OOLogERR(@"hud.dial.invalidSelector", @"HUD dial in %@ uses selector \"%@\" which is in whitelist, but not implemented, and will be ignored.", hudName, selectorString);
704 return;
705 }
706
707 // valid dial, now prefetch data
708 struct CachedInfo cache;
709 prefetchData(info, &cache);
710 // add WIDGET_INFO, WIDGET_CACHE, WIDGET_SELECTOR, WIDGET_SELECTOR_NAME to array
711 [dialArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)],
712 [NSValue valueWithPointer:selector], selectorString, nil]];
713}
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
return nil
NSString * hudName
static void prefetchData(NSDictionary *info, struct CachedInfo *data)
NSDictionary * whitelistDictionary()

References hudName, nil, OOLogERR, prefetchData, and ResourceManager::whitelistDictionary.

Referenced by initWithDictionary:inFile:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLegend:

- (void) addLegend: (NSDictionary*) info

Definition at line 636 of file HeadUpDisplay.m.

636 :(NSDictionary*)info
637{
638 NSString* imageName = nil;
639 OOTexture* texture = nil;
640 NSSize imageSize;
641 OOTextureSprite* legendSprite = nil;
642 NSMutableDictionary* legendDict = nil;
643 struct CachedInfo cache;
644
645 // prefetch data associated with this legend
646 prefetchData(info, &cache);
647
648 imageName = [info oo_stringForKey:IMAGE_KEY];
649 if (imageName != nil) {
650 texture = [OOTexture textureWithName:imageName
651 inFolder:@"Images"
652 options:kOOTextureDefaultOptions | kOOTextureNoShrink
653 anisotropy:kOOTextureDefaultAnisotropy
654 lodBias:kOOTextureDefaultLODBias];
655 if (texture == nil) {
656 OOLogERR(kOOLogFileNotFound, @"HeadUpDisplay couldn't get an image texture name for %@", imageName);
657 return;
658 }
659
660 imageSize = [texture dimensions];
661 imageSize.width = [info oo_floatForKey:WIDTH_KEY defaultValue:imageSize.width];
662 imageSize.height = [info oo_floatForKey:HEIGHT_KEY defaultValue:imageSize.height];
663
664 legendSprite = [[OOTextureSprite alloc] initWithTexture:texture size:imageSize];
665
666 legendDict = [info mutableCopy];
667 [legendDict setObject:legendSprite forKey:SPRITE_KEY];
668 // add WIDGET_INFO, WIDGET_CACHE to array
669 [legendArray addObject:[NSArray arrayWithObjects:legendDict, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
670 [legendDict release];
671 [legendSprite release];
672 } else if ([info oo_stringForKey:TEXT_KEY] != nil) {
673 // add WIDGET_INFO, WIDGET_CACHE to array
674 [legendArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
675 }
676}
#define TEXT_KEY
NSString *const kOOLogFileNotFound
Definition OOLogging.m:601
NSSize dimensions()
Definition OOTexture.m:292
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)
Definition OOTexture.m:132

References OOTexture::dimensions, kOOLogFileNotFound, nil, OOLogERR, prefetchData, TEXT_KEY, and OOTexture::textureWithName:inFolder:options:anisotropy:lodBias:.

Referenced by initWithDictionary:inFile:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMFD:

- (void) addMFD: (NSDictionary*) info

Definition at line 715 of file HeadUpDisplay.m.

715 :(NSDictionary*)info
716{
717 struct CachedInfo cache;
718 prefetchData(info, &cache);
719 [mfdArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
720}

References prefetchData.

Referenced by initWithDictionary:inFile:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowBigGui

- (BOOL) allowBigGui

References allowBigGui, clearHiddenSelectors, isCompassActive, and isUpdating.

Here is the call graph for this function:

◆ checkPlayerInFlight

- (BOOL) checkPlayerInFlight
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1028 of file HeadUpDisplay.m.

1029{
1030 return [PLAYER isInSpace] && [PLAYER status] != STATUS_DOCKING;
1031}

References HeadUpDisplay(Private)::checkPlayerInFlight.

Referenced by HeadUpDisplay(Private)::checkPlayerInFlight, HeadUpDisplay(Private)::checkPlayerInSystemFlight, HeadUpDisplay(Private)::drawPrimedEquipmentText:, and HeadUpDisplay(Private)::drawScanner:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPlayerInSystemFlight

- (BOOL) checkPlayerInSystemFlight
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1033 of file HeadUpDisplay.m.

1034{
1035 OOSunEntity* the_sun = [UNIVERSE sun];
1036 OOPlanetEntity* the_planet = [UNIVERSE planet];
1037
1038 return [self checkPlayerInFlight] // be in the right mode
1039 && the_sun && the_planet // and be in a system
1040 && ![the_sun goneNova];
1041}

References checkPlayerInFlight, HeadUpDisplay(Private)::checkPlayerInSystemFlight, and OOSunEntity::goneNova.

Referenced by HeadUpDisplay(Private)::checkPlayerInSystemFlight, HeadUpDisplay(Private)::drawASCTarget:, HeadUpDisplay(Private)::drawCompass:, HeadUpDisplay(Private)::drawDials, and HeadUpDisplay(Private)::drawPrimedEquipmentText:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearHiddenSelectors

- (void) clearHiddenSelectors

Definition at line 605 of file HeadUpDisplay.m.

606{
607 [_hiddenSelectors removeAllObjects];
608}

References clearHiddenSelectors.

Referenced by allowBigGui, and clearHiddenSelectors.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crosshairDefinition

- (NSString *) crosshairDefinition

References crosshairDefinition, mfdCount, refreshLastTransmitter, and renderHUD.

Here is the call graph for this function:

◆ crosshairDefinitionForWeaponType:

- (NSArray *) crosshairDefinitionForWeaponType: (OOWeaponType) weapon
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 888 of file HeadUpDisplay.m.

888 :(OOWeaponType)weapon
889{
890 NSString* weaponName = nil;
891 NSString* weaponName2 = nil;
892 static NSDictionary* crosshairDefs = nil;
893 NSArray* result = nil;
894
895 /* Search order:
896 (hud.plist).crosshairs.WEAPON_NAME
897 (hud.plist).crosshairs.OTHER
898 (crosshairs.plist).WEAPON_NAME
899 (crosshairs.plist).OTHER
900 */
901
902 weaponName = OOStringFromWeaponType(weapon);
903 weaponName2 = [weaponName substringFromIndex:3]; // strip "EQ_"
904 result = [_crosshairOverrides oo_arrayForKey:weaponName];
905 if (result == nil) {
906 result = [_crosshairOverrides oo_arrayForKey:weaponName2];
907 }
908 if (result == nil)
909 result = [_crosshairOverrides oo_arrayForKey:@"OTHER"];
910 if (result == nil) {
911 if (crosshairDefs == nil) {
912 crosshairDefs = [ResourceManager dictionaryFromFilesNamed:@"crosshairs.plist"
913 inFolder:@"Config"
914 andMerge:YES];
915 [crosshairDefs retain];
916 }
917
918 result = [crosshairDefs oo_arrayForKey:weaponName];
919 if (result == nil) {
920 result = [crosshairDefs oo_arrayForKey:weaponName2];
921 }
922 if (result == nil)
923 result = [crosshairDefs oo_arrayForKey:@"OTHER"];
924 }
925
926 return result;
927}
OOEquipmentType * OOWeaponType
Definition ShipEntity.h:164
NSString * OOStringFromWeaponType(OOWeaponType weapon) CONST_FUNC
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

References ResourceManager::dictionaryFromFilesNamed:inFolder:andMerge:, nil, and OOStringFromWeaponType().

Referenced by HeadUpDisplay(Private)::drawCrosshairs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Definition at line 326 of file HeadUpDisplay.m.

327{
339
340 [super dealloc];
341}
#define DESTROY(x)
NSMutableArray * _reticleColors
NSString * deferredHudName
NSString * crosshairDefinition
OOColor * _crosshairColor
NSMutableSet * _hiddenSelectors
NSMutableArray * mfdArray
NSDictionary * _crosshairOverrides
NSMutableArray * dialArray
NSMutableDictionary * propertiesReticleTargetSensitive
NSMutableArray * legendArray

References _crosshairColor, _crosshairOverrides, _hiddenSelectors, _reticleColors, crosshairDefinition, dealloc, deferredHudName, DESTROY, dialArray, hudName, legendArray, mfdArray, and propertiesReticleTargetSensitive.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deferredHudName

- (NSString *) deferredHudName

References deferredHudName.

◆ drawAegis:

- (void) drawAegis: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1641 of file HeadUpDisplay.m.

1641 :(NSDictionary*)info
1642{
1643 if (([UNIVERSE viewDirection] == VIEW_GUI_DISPLAY) || ([UNIVERSE sun] == nil) || ([PLAYER checkForAegis] != AEGIS_IN_DOCKING_RANGE))
1644 return; // don't draw
1645
1646 int x, y;
1647 NSSize siz;
1648 GLfloat alpha = 0.5f * overallAlpha;
1649 struct CachedInfo cached;
1650
1651 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1652
1653 x = useDefined(cached.x, AEGIS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1654 y = useDefined(cached.y, AEGIS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1655 siz.width = useDefined(cached.width, AEGIS_WIDTH);
1656 siz.height = useDefined(cached.height, AEGIS_HEIGHT);
1657 alpha *= cached.alpha;
1658
1659 // draw the aegis indicator
1660 //
1661 GLfloat w = siz.width / 16.0;
1662 GLfloat h = siz.height / 16.0;
1663
1664 GLfloat strip[] = { -7, 8, -6, 5, 5, 8, 3, 5, 7, 2, 4, 2, 6, -1, 4, 2, -4, -1, -6, 2, -4, -1, -7, -1, -3, -4, -5, -7, 6, -4, 7, -7 };
1665
1666#if 1
1667 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1668 OOGLBEGIN(GL_QUAD_STRIP);
1669 int i;
1670 for (i = 0; i < 32; i += 2) {
1671 glVertex3f(x + w * strip[i], y - h * strip[i + 1], z1);
1672 }
1673 OOGLEND();
1674#else
1677 OOGLScaleModelView(make_vector(w, -h, 1.0f));
1678
1679 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1680 OOGL(glVertexPointer(2, GL_FLOAT, 0, strip));
1681 OOGL(glEnableClientState(GL_VERTEX_ARRAY));
1682 OOGL(glDisableClientState(GL_COLOR_ARRAY));
1683
1684 OOGL(glDrawArrays(GL_QUAD_STRIP, 0, sizeof strip / sizeof *strip / 2));
1685 OOGL(glDisableClientState(GL_VERTEX_ARRAY));
1686
1688#endif
1689}
#define AEGIS_CENTRE_Y
#define AEGIS_CENTRE_X
#define AEGIS_WIDTH
#define AEGIS_HEIGHT
OOINLINE float useDefined(float val, float validVal)
void OOGLScaleModelView(Vector scale)
void OOGLPushModelView(void)
void OOGLTranslateModelView(Vector vector)
OOMatrix OOGLPopModelView(void)
#define OOGLBEGIN
Definition OOOpenGL.h:269
#define OOGL(statement)
Definition OOOpenGL.h:262
#define OOGLEND
Definition OOOpenGL.h:270
float y
float x
@ AEGIS_IN_DOCKING_RANGE
Definition OOTypes.h:57
OOINLINE Vector make_vector(OOScalar vx, OOScalar vy, OOScalar vz) INLINE_CONST_FUNC
Definition OOVector.h:149
#define PLAYER
#define UNIVERSE
Definition Universe.h:827
GLfloat overallAlpha

References AEGIS_CENTRE_X, AEGIS_CENTRE_Y, AEGIS_HEIGHT, AEGIS_IN_DOCKING_RANGE, AEGIS_WIDTH, CachedInfo::alpha, CachedInfo::height, make_vector(), nil, OOGL, OOGLBEGIN, OOGLEND, OOGLPopModelView(), OOGLPushModelView(), OOGLScaleModelView(), OOGLTranslateModelView(), PLAYER, UNIVERSE, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawAftShieldBar:

- (void) drawAftShieldBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2082 of file HeadUpDisplay.m.

2082 :(NSDictionary*)info
2083{
2084 int x, y;
2085 NSSize siz;
2086 BOOL draw_surround;
2087 GLfloat alpha = overallAlpha;
2088 GLfloat shield = [PLAYER dialAftShield];
2089 struct CachedInfo cached;
2090
2091 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2092
2093 x = useDefined(cached.x, AFT_SHIELD_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2094 y = useDefined(cached.y, AFT_SHIELD_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2096 siz.height = useDefined(cached.height, AFT_SHIELD_BAR_HEIGHT);
2097 alpha *= cached.alpha;
2098 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:AFT_SHIELD_BAR_DRAW_SURROUND];
2099
2100 if (draw_surround) {
2101 // draw forward_shield surround
2103 hudDrawSurroundAt(x, y, z1, siz);
2104 }
2105 // draw forward_shield bar
2106 if (shield < .25) {
2108 } else if (shield < .80) {
2110 } else {
2112 }
2113 hudDrawBarAt(x, y, z1, siz, shield);
2114}
#define AFT_SHIELD_BAR_HEIGHT
#define AFT_SHIELD_BAR_CENTRE_Y
#define AFT_SHIELD_BAR_WIDTH
#define AFT_SHIELD_BAR_CENTRE_X
#define SET_COLOR_LOW(d)
#define SET_COLOR_MEDIUM(d)
static const GLfloat green_color[4]
#define SET_COLOR_HIGH(d)
static const GLfloat yellow_color[4]
#define SET_COLOR_SURROUND(d)
static const GLfloat red_color[4]
static void hudDrawBarAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
static void hudDrawSurroundAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz)

References AFT_SHIELD_BAR_CENTRE_X, AFT_SHIELD_BAR_CENTRE_Y, AFT_SHIELD_BAR_HEIGHT, AFT_SHIELD_BAR_WIDTH, CachedInfo::alpha, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawAltitudeBar:

- (void) drawAltitudeBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2265 of file HeadUpDisplay.m.

2265 :(NSDictionary*)info
2266{
2267 int x, y;
2268 NSSize siz;
2269 BOOL draw_surround;
2270 GLfloat alt = [PLAYER dialAltitude];
2271 GLfloat alpha = overallAlpha;
2272 struct CachedInfo cached;
2273
2274 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2275
2276 x = useDefined(cached.x, ALTITUDE_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2277 y = useDefined(cached.y, ALTITUDE_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2279 siz.height = useDefined(cached.height, ALTITUDE_BAR_HEIGHT);
2280 alpha *= cached.alpha;
2281 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2282
2283 if (draw_surround) {
2285 hudDrawSurroundAt(x, y, z1, siz);
2286 }
2287
2288 int flash = (int)([UNIVERSE getTime] * 4);
2289 flash &= 1;
2290
2291 // draw altitude bar (evaluating the least amount of ifs per go)
2292 if (alt < .25) {
2293 if (alt < .10 && flash)
2295 else
2297 } else {
2298 if (alt < .75)
2300 else
2302 }
2303
2304 hudDrawBarAt(x, y, z1, siz, alt);
2305}
#define ALTITUDE_BAR_CENTRE_X
#define ALTITUDE_BAR_WIDTH
#define ALTITUDE_BAR_HEIGHT
#define ALTITUDE_BAR_CENTRE_Y
#define SET_COLOR_CRITICAL(d)
static const GLfloat redplus_color[4]
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

References CachedInfo::alpha, ALTITUDE_BAR_CENTRE_X, ALTITUDE_BAR_CENTRE_Y, ALTITUDE_BAR_HEIGHT, ALTITUDE_BAR_WIDTH, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), int(), red_color, redplus_color, SET_COLOR_CRITICAL, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, UNIVERSE, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawASCTarget:

- (void) drawASCTarget: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2757 of file HeadUpDisplay.m.

2757 :(NSDictionary*)info
2758{
2759 if (!([self checkPlayerInSystemFlight] && [PLAYER status] != STATUS_LAUNCHING)) // normal system
2760 {
2761 // Can't have compass target when docked, etc. (matches blip condition)
2762 return;
2763 }
2764
2765 GLfloat itemColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
2766 struct CachedInfo cached;
2767
2768 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2769
2770 NSInteger x = useDefined(cached.x, ASCTARGET_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2771 NSInteger y = useDefined(cached.y, ASCTARGET_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2772
2773 NSSize size = {
2774 .width = useDefined(cached.width, ASCTARGET_DISPLAY_WIDTH),
2775 .height = useDefined(cached.height, ASCTARGET_DISPLAY_HEIGHT)
2776 };
2777
2778 GetRGBAArrayFromInfo(info, itemColor);
2779 itemColor[3] *= overallAlpha;
2780
2781 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2782 if ([info oo_intForKey:@"align"] == 1) {
2783 OODrawStringAligned([PLAYER compassTargetLabel], x, y, z1, size, YES);
2784 } else {
2785 OODrawStringAligned([PLAYER compassTargetLabel], x, y, z1, size, NO);
2786 }
2787}
#define ASCTARGET_DISPLAY_WIDTH
#define ASCTARGET_DISPLAY_HEIGHT
#define ASCTARGET_DISPLAY_X
#define ASCTARGET_DISPLAY_Y
static void GetRGBAArrayFromInfo(NSDictionary *info, GLfloat ioColor[4])
BOOL checkPlayerInSystemFlight()
void OODrawStringAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
voidpf void uLong size
Definition ioapi.h:126

References ASCTARGET_DISPLAY_HEIGHT, ASCTARGET_DISPLAY_WIDTH, ASCTARGET_DISPLAY_X, ASCTARGET_DISPLAY_Y, HeadUpDisplay(Private)::checkPlayerInSystemFlight, GetRGBAArrayFromInfo(), CachedInfo::height, OODrawStringAligned(), OOGL, PLAYER, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawCabinTempBar:

- (void) drawCabinTempBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2191 of file HeadUpDisplay.m.

2191 :(NSDictionary*)info
2192{
2193 int x, y;
2194 NSSize siz;
2195 BOOL draw_surround;
2196 GLfloat temp = [PLAYER hullHeatLevel];
2197 GLfloat alpha = overallAlpha;
2198 struct CachedInfo cached;
2199
2200 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2201
2202 x = useDefined(cached.x, CABIN_TEMP_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2203 y = useDefined(cached.y, CABIN_TEMP_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2205 siz.height = useDefined(cached.height, CABIN_TEMP_BAR_HEIGHT);
2206 alpha *= cached.alpha;
2207 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2208
2209 if (draw_surround) {
2211 hudDrawSurroundAt(x, y, z1, siz);
2212 }
2213
2214 int flash = (int)([UNIVERSE getTime] * 4);
2215 flash &= 1;
2216 // what color are we?
2217 if (temp > .80) {
2218 if (temp > .90 && flash)
2220 else
2222 } else {
2223 if (temp > .25)
2225 else
2227 }
2228
2229 hudDrawBarAt(x, y, z1, siz, temp);
2230}
#define CABIN_TEMP_BAR_HEIGHT
#define CABIN_TEMP_BAR_CENTRE_Y
#define CABIN_TEMP_BAR_WIDTH
#define CABIN_TEMP_BAR_CENTRE_X

References CachedInfo::alpha, CABIN_TEMP_BAR_CENTRE_X, CABIN_TEMP_BAR_CENTRE_Y, CABIN_TEMP_BAR_HEIGHT, CABIN_TEMP_BAR_WIDTH, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), int(), red_color, redplus_color, SET_COLOR_CRITICAL, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, UNIVERSE, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawCharacterQuad

+ (GLfloat) drawCharacterQuad (uint8_t) chr
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3602 of file HeadUpDisplay.m.

3603{
3604 // 31 (narrow space) and 32 (space) are non-printing characters, so
3605 // don't print them, just return their width to move the pointer
3606 if (chr > 32 || chr < 31) {
3607 GLfloat texture_x = ONE_SIXTEENTH * (chr & 0x0f);
3608 GLfloat texture_y = ONE_SIXTEENTH * (chr >> 4);
3609 if (chr > 32)
3610 y += ONE_EIGHTH * siz.height; // Adjust for baseline offset change in 1.71 (needed to keep accented characters in box)
3611
3612 glTexCoord2f(texture_x, texture_y + ONE_SIXTEENTH);
3613 glVertex3f(x, y, z);
3614 glTexCoord2f(texture_x + ONE_SIXTEENTH, texture_y + ONE_SIXTEENTH);
3615 glVertex3f(x + siz.width, y, z);
3616 glTexCoord2f(texture_x + ONE_SIXTEENTH, texture_y);
3617 glVertex3f(x + siz.width, y + siz.height, z);
3618 glTexCoord2f(texture_x, texture_y);
3619 glVertex3f(x, y + siz.height, z);
3620 }
3621 return siz.width * sGlyphWidths[chr];
3622}
#define ONE_EIGHTH
#define ONE_SIXTEENTH
static float sGlyphWidths[256]

References drawCharacterQuad, ONE_EIGHTH, ONE_SIXTEENTH, sGlyphWidths, x, and y.

Referenced by drawCharacterQuad, OODrawPlanetInfo, and OODrawStringQuadsAligned.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawClock:

- (void) drawClock: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2685 of file HeadUpDisplay.m.

2685 :(NSDictionary*)info
2686{
2687 int x, y;
2688 NSSize siz;
2689 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2690 struct CachedInfo cached;
2691
2692 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2693
2694 x = useDefined(cached.x, CLOCK_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2695 y = useDefined(cached.y, CLOCK_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2697 siz.height = useDefined(cached.height, CLOCK_DISPLAY_HEIGHT);
2698
2699 GetRGBAArrayFromInfo(info, itemColor);
2700 itemColor[3] *= overallAlpha;
2701
2702 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2703 OODrawString([PLAYER dial_clock], x, y, z1, siz);
2704}
#define CLOCK_DISPLAY_WIDTH
#define CLOCK_DISPLAY_Y
#define CLOCK_DISPLAY_X
#define CLOCK_DISPLAY_HEIGHT
void OODrawString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)

References CLOCK_DISPLAY_HEIGHT, CLOCK_DISPLAY_WIDTH, CLOCK_DISPLAY_X, CLOCK_DISPLAY_Y, GetRGBAArrayFromInfo(), CachedInfo::height, OODrawString(), OOGL, PLAYER, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawCompass:

- (void) drawCompass: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1455 of file HeadUpDisplay.m.

1455 :(NSDictionary*)info
1456{
1457 int x, y;
1458 NSSize siz;
1459 GLfloat alpha;
1460 GLfloat compass_color[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
1461 struct CachedInfo cached;
1462
1463 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1464
1465 x = useDefined(cached.x, COMPASS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1466 y = useDefined(cached.y, COMPASS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1467 siz.width = useDefined(cached.width, COMPASS_HALF_SIZE);
1468 siz.height = useDefined(cached.height, COMPASS_HALF_SIZE);
1469
1470 GetRGBAArrayFromInfo(info, compass_color);
1471 compass_color[3] *= overallAlpha;
1472 alpha = compass_color[3];
1473
1474 // draw the compass
1475 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1476
1477 GLfloat h1 = siz.height * 0.125;
1478 GLfloat h3 = siz.height * 0.375;
1479 GLfloat w1 = siz.width * 0.125;
1480 GLfloat w3 = siz.width * 0.375;
1481 OOGL(GLScaledLineWidth(2.0 * lineWidth)); // thicker
1482 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], alpha));
1483 GLDrawOval(x, y, z1, siz, 12);
1484 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], 0.5f * alpha));
1485 OOGLBEGIN(GL_LINES);
1486 glVertex3f(x - w1, y, z1);
1487 glVertex3f(x - w3, y, z1);
1488 glVertex3f(x + w1, y, z1);
1489 glVertex3f(x + w3, y, z1);
1490 glVertex3f(x, y - h1, z1);
1491 glVertex3f(x, y - h3, z1);
1492 glVertex3f(x, y + h1, z1);
1493 glVertex3f(x, y + h3, z1);
1494 OOGLEND();
1495 OOGL(GLScaledLineWidth(lineWidth)); // thinner
1496
1497 if ([self checkPlayerInSystemFlight] && [PLAYER status] != STATUS_LAUNCHING) // normal system
1498 {
1499 Entity* reference = [PLAYER compassTarget];
1500
1501 // translate and rotate the view
1502
1503 Vector relativePosition = [PLAYER vectorTo:reference];
1504 relativePosition = OOVectorMultiplyMatrix(relativePosition, rotMatrix);
1505 relativePosition = vector_normal_or_fallback(relativePosition, kBasisZVector);
1506
1507 relativePosition.x *= siz.width * 0.4;
1508 relativePosition.y *= siz.height * 0.4;
1509 relativePosition.x += x;
1510 relativePosition.y += y;
1511
1512 siz.width *= 0.2;
1513 siz.height *= 0.2;
1515 switch ([PLAYER compassMode]) {
1516 case COMPASS_MODE_INACTIVE:
1517 break;
1518
1519 case COMPASS_MODE_BASIC:
1520 if ([reference isStation]) // validateCompassTarget in PlayerEntity.m changes COMPASS_BASIC_MODE target to the main station when inside the planetary aegis or in docking range of the main station
1521 [self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1522 else
1523 [self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1524 break;
1525
1526 case COMPASS_MODE_PLANET:
1527 [self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1528 break;
1529
1530 case COMPASS_MODE_STATION:
1531 [self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1532 break;
1533
1534 case COMPASS_MODE_SUN:
1535 [self drawCompassSunBlipAt:relativePosition Size:siz Alpha:alpha];
1536 break;
1537
1538 case COMPASS_MODE_TARGET:
1539 [self drawCompassTargetBlipAt:relativePosition Size:siz Alpha:alpha];
1540 break;
1541
1542 case COMPASS_MODE_BEACONS:
1543 [self drawCompassBeaconBlipAt:relativePosition Size:siz Alpha:alpha];
1544 Entity<OOBeaconEntity>* beacon = [PLAYER nextBeacon];
1545 [[beacon beaconDrawable] oo_drawHUDBeaconIconAt:NSMakePoint(x, y) size:siz alpha:alpha z:z1];
1546 break;
1547 }
1548 OOGL(GLScaledLineWidth(lineWidth)); // reset
1549
1550 _compassUpdated = YES;
1551 _compassActive = YES;
1552 }
1553}
#define COMPASS_CENTRE_Y
#define COMPASS_CENTRE_X
#define COMPASS_HALF_SIZE
static BOOL _compassUpdated
Vector OOVectorMultiplyMatrix(Vector v, OOMatrix m) CONST_FUNC
Definition OOMatrix.m:121
struct OOMatrix OOMatrix
void GLScaledLineWidth(GLfloat width)
Definition OOOpenGL.m:206
void GLDrawOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
Definition OOOpenGL.m:149
struct Vector Vector
OOINLINE Vector vector_normal_or_fallback(Vector vec, Vector fallback) INLINE_CONST_FUNC
Definition OOVector.h:247
const Vector kBasisZVector
Definition OOVector.h:47
OOScalar x
Definition OOVector.h:32

References _compassUpdated, HeadUpDisplay(Private)::checkPlayerInSystemFlight, COMPASS_CENTRE_X, COMPASS_CENTRE_Y, COMPASS_HALF_SIZE, drawCompassBeaconBlipAt:Size:Alpha:, drawCompassPlanetBlipAt:Size:Alpha:, drawCompassStationBlipAt:Size:Alpha:, drawCompassSunBlipAt:Size:Alpha:, drawCompassTargetBlipAt:Size:Alpha:, GetRGBAArrayFromInfo(), GLDrawOval(), GLScaledLineWidth(), CachedInfo::height, kBasisZVector, OOGL, OOGLBEGIN, OOGLEND, OOVectorMultiplyMatrix(), PLAYER, useDefined(), vector_normal_or_fallback(), CachedInfo::width, CachedInfo::x, Vector::x, x, CachedInfo::x0, CachedInfo::y, Vector::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawCompassBeaconBlipAt:Size:Alpha:

- (void) drawCompassBeaconBlipAt: (Vector) relativePosition
Size: (NSSize) siz
Alpha: (GLfloat) alpha 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1613 of file HeadUpDisplay.m.

1613 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1614{
1615 SetCompassBlipColor(relativePosition.z, alpha);
1616
1617 OOGLBEGIN(GL_LINES);
1618 /* glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1619 glVertex3f(relativePosition.x, relativePosition.y + 0.5 * siz.height, z1);
1620
1621 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1622 glVertex3f(relativePosition.x, relativePosition.y + 0.5 * siz.height, z1);
1623
1624 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1625 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1); */
1626 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1627 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1628
1629 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1630 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1631
1632 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1633 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1634
1635 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1636 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1637
1638 OOGLEND();
1639}
OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
OOScalar y
Definition OOVector.h:33
OOScalar z
Definition OOVector.h:34

References OOGLBEGIN, OOGLEND, Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawCompass:.

Here is the caller graph for this function:

◆ drawCompassPlanetBlipAt:Size:Alpha:

- (void) drawCompassPlanetBlipAt: (Vector) relativePosition
Size: (NSSize) siz
Alpha: (GLfloat) alpha 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1564 of file HeadUpDisplay.m.

1564 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1565{
1566 if (relativePosition.z >= 0) {
1567 OOGL(glColor4f(0.0, 1.0, 0.0, 0.75 * alpha));
1568 GLDrawFilledOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1569 OOGL(glColor4f(0.0, 1.0, 0.0, alpha));
1570 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1571 } else {
1572 OOGL(glColor4f(1.0, 0.0, 0.0, alpha));
1573 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1574 }
1575}

References GLDrawFilledOval(), GLDrawOval(), OOGL, Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawCompass:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawCompassStationBlipAt:Size:Alpha:

- (void) drawCompassStationBlipAt: (Vector) relativePosition
Size: (NSSize) siz
Alpha: (GLfloat) alpha 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1577 of file HeadUpDisplay.m.

1577 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1578{
1579 SetCompassBlipColor(relativePosition.z, alpha);
1580
1581 OOGLBEGIN(GL_LINE_LOOP);
1582 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1583 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1584 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y + 0.5 * siz.height, z1);
1585 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y + 0.5 * siz.height, z1);
1586 OOGLEND();
1587}

References OOGLBEGIN, OOGLEND, Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawCompass:.

Here is the caller graph for this function:

◆ drawCompassSunBlipAt:Size:Alpha:

- (void) drawCompassSunBlipAt: (Vector) relativePosition
Size: (NSSize) siz
Alpha: (GLfloat) alpha 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1589 of file HeadUpDisplay.m.

1589 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1590{
1591 OOGL(glColor4f(1.0, 1.0, 0.0, 0.75 * alpha));
1592 GLDrawFilledOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1593
1594 SetCompassBlipColor(relativePosition.z, alpha);
1595
1596 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1597}
void GLDrawFilledOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
Definition OOOpenGL.m:158

References GLDrawFilledOval(), GLDrawOval(), OOGL, Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawCompass:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawCompassTargetBlipAt:Size:Alpha:

- (void) drawCompassTargetBlipAt: (Vector) relativePosition
Size: (NSSize) siz
Alpha: (GLfloat) alpha 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1599 of file HeadUpDisplay.m.

1599 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1600{
1601 SetCompassBlipColor(relativePosition.z, alpha);
1602
1603 OOGLBEGIN(GL_LINES);
1604 glVertex3f(relativePosition.x - siz.width, relativePosition.y, z1);
1605 glVertex3f(relativePosition.x + siz.width, relativePosition.y, z1);
1606 glVertex3f(relativePosition.x, relativePosition.y - siz.height, z1);
1607 glVertex3f(relativePosition.x, relativePosition.y + siz.height, z1);
1608 OOGLEND();
1609
1610 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1611}

References GLDrawOval(), OOGLBEGIN, OOGLEND, Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawCompass:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawCrosshairs

- (void) drawCrosshairs
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 826 of file HeadUpDisplay.m.

827{
828 OOViewID viewID = [UNIVERSE viewDirection];
829 OOWeaponType weapon = [PLAYER currentWeapon];
830 BOOL weaponsOnline = [PLAYER weaponsOnline];
831 NSArray* points = nil;
832
833 if (viewID == VIEW_CUSTOM || overallAlpha == 0.0f || !([PLAYER status] == STATUS_IN_FLIGHT || [PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
834 [UNIVERSE displayGUI]) {
835 // Don't draw crosshairs
836 return;
837 }
838
839 if (weapon != _lastWeaponType || overallAlpha != _lastOverallAlpha || weaponsOnline != _lastWeaponsOnline) {
841 }
842
843 if (_crosshairs == nil) {
844 GLfloat useAlpha = weaponsOnline ? overallAlpha : overallAlpha * 0.5f;
845
846 // Make new crosshairs object
847 points = [self crosshairDefinitionForWeaponType:weapon];
848
849 _crosshairs = [[OOCrosshairs alloc] initWithPoints:points
850 scale:_crosshairScale
851 color:_crosshairColor
852 overallAlpha:useAlpha];
853 _lastWeaponType = weapon;
854 _lastOverallAlpha = useAlpha;
855 _lastWeaponsOnline = weaponsOnline;
856 }
857
858 [_crosshairs render];
859}
OOViewID
Definition OOTypes.h:39
OOCrosshairs * _crosshairs
OOWeaponType _lastWeaponType
GLfloat _lastOverallAlpha

References crosshairDefinitionForWeaponType:, DESTROY, HeadUpDisplay(Private)::drawCrosshairs, nil, PLAYER, and UNIVERSE.

Referenced by HeadUpDisplay(Private)::drawCrosshairs, and renderHUD.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawCustomBar:

- (void) drawCustomBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1691 of file HeadUpDisplay.m.

1691 :(NSDictionary*)info
1692{
1693 int x, y;
1694 NSSize siz;
1695 BOOL draw_surround;
1696 GLfloat alpha = overallAlpha;
1697 GLfloat ds = OOClamp_0_1_f([PLAYER dialCustomFloat:[info oo_stringForKey:CUSTOM_DIAL_KEY]]);
1698 struct CachedInfo cached;
1699
1700 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1701
1702 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1703 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1704 siz.width = useDefined(cached.width, 50);
1705 siz.height = useDefined(cached.height, 8);
1706 alpha *= cached.alpha;
1707
1708 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1709
1711 if (draw_surround) {
1712 // draw custom surround
1713 hudDrawSurroundAt(x, y, z1, siz);
1714 }
1715 // draw custom bar
1716 if (ds > .75) {
1718 } else if (ds > .25) {
1720 } else {
1722 }
1723
1724 hudDrawBarAt(x, y, z1, siz, ds);
1725}
#define CUSTOM_DIAL_KEY
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC

References CachedInfo::alpha, CUSTOM_DIAL_KEY, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), OOClamp_0_1_f(), PLAYER, red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawCustomImage:

- (void) drawCustomImage: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1816 of file HeadUpDisplay.m.

1816 :(NSDictionary*)info
1817{
1818 int x, y;
1819 GLfloat alpha = overallAlpha;
1820
1821 struct CachedInfo cached;
1822
1823 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1824
1825 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1826 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1827 alpha *= cached.alpha;
1828
1829 NSString* textureFile = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1830 if (textureFile == nil || [textureFile length] == 0) {
1831 return;
1832 }
1833
1834 OOTexture* texture = [OOTexture textureWithName:textureFile
1835 inFolder:@"Images"
1836 options:kOOTextureDefaultOptions | kOOTextureNoShrink
1837 anisotropy:kOOTextureDefaultAnisotropy
1838 lodBias:kOOTextureDefaultLODBias];
1839 if (texture == nil) {
1840 OOLogERR(kOOLogFileNotFound, @"HeadUpDisplay couldn't get an image texture name for %@", textureFile);
1841 return;
1842 }
1843
1844 NSSize imageSize = [texture dimensions];
1845 imageSize.width = useDefined(cached.width, imageSize.width);
1846 imageSize.height = useDefined(cached.height, imageSize.height);
1847
1848 /* There's possibly some optimisation which could be done by
1849 * caching the sprite, but regenerating it each frame doesn't
1850 * appear to take any significant amount of time compared with the
1851 * time taken to actually render it and the texture will be
1852 * returned from the cache anyway. - CIM */
1853 OOTextureSprite* sprite = [[OOTextureSprite alloc] initWithTexture:texture size:imageSize];
1854
1855 [sprite blitCentredToX:x Y:y Z:z1 alpha:alpha];
1856 [sprite release];
1857}
void blitCentredToX:Y:Z:alpha:(float x,[Y] float y,[Z] float z,[alpha] float a)

References CachedInfo::alpha, OOTextureSprite::blitCentredToX:Y:Z:alpha:, OOTexture::dimensions, CachedInfo::height, kOOLogFileNotFound, nil, OOLogERR, OOTexture::textureWithName:inFolder:options:anisotropy:lodBias:, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawCustomIndicator:

- (void) drawCustomIndicator: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1753 of file HeadUpDisplay.m.

1753 :(NSDictionary*)info
1754{
1755 int x, y;
1756 NSSize siz;
1757 BOOL draw_surround;
1758 GLfloat alpha = overallAlpha;
1759 GLfloat iv = OOClamp_n1_1_f([PLAYER dialCustomFloat:[info oo_stringForKey:CUSTOM_DIAL_KEY]]);
1760
1761 struct CachedInfo cached;
1762
1763 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1764
1765 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1766 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1767 siz.width = useDefined(cached.width, 50);
1768 siz.height = useDefined(cached.height, 8);
1769 alpha *= cached.alpha;
1770 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1771
1772 if (draw_surround) {
1773 // draw custom surround
1775 hudDrawSurroundAt(x, y, z1, siz);
1776 }
1777 // draw custom indicator
1779 hudDrawIndicatorAt(x, y, z1, siz, iv);
1780}
#define SET_COLOR(d)
OOINLINE float OOClamp_n1_1_f(float value) INLINE_CONST_FUNC
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)

References CachedInfo::alpha, CUSTOM_DIAL_KEY, green_color, CachedInfo::height, hudDrawIndicatorAt(), hudDrawSurroundAt(), OOClamp_n1_1_f(), PLAYER, SET_COLOR, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawCustomLight:

- (void) drawCustomLight: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1782 of file HeadUpDisplay.m.

1782 :(NSDictionary*)info
1783{
1784 int x, y;
1785 NSSize siz;
1786 GLfloat alpha = overallAlpha;
1787
1788 struct CachedInfo cached;
1789
1790 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1791
1792 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1793 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1794 siz.width = useDefined(cached.width, 8);
1795 siz.height = useDefined(cached.height, 8);
1796 alpha *= cached.alpha;
1797
1798 GLfloat light_color[4] = { 0.25, 0.25, 0.25, 0.0 };
1799
1800 OOColor* color = [PLAYER dialCustomColor:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1801 [color getRed:&light_color[0]
1802 green:&light_color[1]
1803 blue:&light_color[2]
1804 alpha:&light_color[3]];
1805
1806 GLColorWithOverallAlpha(light_color, alpha);
1807 OOGLBEGIN(GL_POLYGON);
1808 hudDrawStatusIconAt(x, y, z1, siz);
1809 OOGLEND();
1810 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
1811 OOGLBEGIN(GL_LINE_LOOP);
1812 hudDrawStatusIconAt(x, y, z1, siz);
1813 OOGLEND();
1814}
static void hudDrawStatusIconAt(int x, int y, int z, NSSize siz)
OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
Definition OOColor.m:344

References CachedInfo::alpha, OOColor::getRed:green:blue:alpha:, CachedInfo::height, hudDrawStatusIconAt(), OOGL, OOGLBEGIN, OOGLEND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawCustomText:

- (void) drawCustomText: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1727 of file HeadUpDisplay.m.

1727 :(NSDictionary*)info
1728{
1729 int x, y;
1730 NSSize size;
1731 GLfloat alpha = overallAlpha;
1732 NSString* text = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1733 struct CachedInfo cached;
1734
1735 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1736
1737 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1738 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1739 alpha *= cached.alpha;
1740
1742
1743 size.width = useDefined(cached.width, 10.0f);
1744 size.height = useDefined(cached.height, 10.0f);
1745
1746 if ([info oo_intForKey:@"align"] == 1) {
1747 OODrawStringAligned(text, x, y, z1, size, YES);
1748 } else {
1749 OODrawStringAligned(text, x, y, z1, size, NO);
1750 }
1751}

References CachedInfo::alpha, CachedInfo::height, OODrawStringAligned(), SET_COLOR, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawDials

- (void) drawDials
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 792 of file HeadUpDisplay.m.

793{
794 z1 = [[UNIVERSE gameView] display_z];
795 // reset drawScanner flag.
796 _compassUpdated = NO;
797
798 // tight loop, we assume dialArray doesn't change in mid-draw.
799 NSUInteger i, nDials = [dialArray count];
800 for (i = 0; i < nDials; i++) {
801 sCurrentDrawItem = [dialArray oo_arrayAtIndex:i];
802 [self drawHUDItem:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
803 }
804
805 if (EXPECT_NOT(!_compassUpdated && _compassActive && [self checkPlayerInSystemFlight])) // compass gone / broken / disabled ?
806 {
807 // trigger the targetChanged event with whom == null
808 _compassActive = NO;
809 [PLAYER doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:[NSNull null], OOStringFromCompassMode([PLAYER compassMode]), nil]];
810 }
811}
static NSArray * sCurrentDrawItem
#define EXPECT_NOT(x)

References _compassUpdated, HeadUpDisplay(Private)::checkPlayerInSystemFlight, HeadUpDisplay(Private)::drawDials, drawHUDItem:, EXPECT_NOT, and sCurrentDrawItem.

Referenced by HeadUpDisplay(Private)::drawDials, and renderHUD.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawDirectionCue:

- (void) drawDirectionCue: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2599 of file HeadUpDisplay.m.

2599 :(NSDictionary*)info
2600{
2601 GLfloat alpha = overallAlpha;
2602 struct CachedInfo cached;
2603
2604 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2605
2606 alpha *= cached.alpha;
2607
2608 if ([UNIVERSE displayGUI])
2609 return;
2610
2611 Entity* target = [PLAYER primaryTarget];
2612 if (target == nil)
2613 return;
2614
2615 // draw the direction cue
2616 OOMatrix rotMatrix;
2617
2618 rotMatrix = [PLAYER rotationMatrix];
2619
2620 if ([UNIVERSE viewDirection] != VIEW_GUI_DISPLAY) {
2621 const GLfloat innerSize = CROSSHAIR_SIZE;
2622 const GLfloat width = CROSSHAIR_SIZE * ONE_EIGHTH;
2623 const GLfloat outerSize = CROSSHAIR_SIZE * (1.0f + ONE_EIGHTH + ONE_EIGHTH);
2624 const float visMin = 0.994521895368273f; // cos(6 degrees)
2625 const float visMax = 0.984807753012208f; // cos(10 degrees)
2626
2627 // Transform the view
2628 Vector rpn = [PLAYER vectorTo:target];
2629 rpn = OOVectorMultiplyMatrix(rpn, rotMatrix);
2630 Vector drawPos = rpn;
2631 Vector forward = kZeroVector;
2632
2633 switch ([UNIVERSE viewDirection]) {
2634 case VIEW_FORWARD:
2635 forward = kBasisZVector;
2636 break;
2637 case VIEW_AFT:
2638 drawPos.x = -drawPos.x;
2639 forward = vector_flip(kBasisZVector);
2640 break;
2641 case VIEW_PORT:
2642 drawPos.x = drawPos.z;
2643 forward = vector_flip(kBasisXVector);
2644 break;
2645 case VIEW_STARBOARD:
2646 drawPos.x = -drawPos.z;
2647 forward = kBasisXVector;
2648 break;
2649 case VIEW_CUSTOM:
2650 return;
2651
2652 default:
2653 break;
2654 }
2655
2656 float cosAngle = dot_product(vector_normal(rpn), forward);
2657 float visibility = 1.0f - ((visMax - cosAngle) * (1.0f / (visMax - visMin)));
2658 alpha *= OOClamp_0_1_f(visibility);
2659
2660 if (alpha > 0.0f) {
2661 NSUInteger cueColorIndex = [target isWormhole] ? OO_RETICLE_COLOR_WORMHOLE : OO_RETICLE_COLOR_TARGET;
2662 OOColor* directionCueColor = [_reticleColors objectAtIndex:cueColorIndex];
2663 GLfloat clearColorArray[4] = { [directionCueColor redComponent],
2664 [directionCueColor greenComponent],
2665 [directionCueColor blueComponent],
2666 0.0f };
2667 GLfloat directionCueColorArray[4] = { [directionCueColor redComponent],
2668 [directionCueColor greenComponent],
2669 [directionCueColor blueComponent],
2670 [directionCueColor alphaComponent] };
2671 drawPos.z = 0.0f; // flatten vector
2672 drawPos = vector_normal(drawPos);
2673 OOGLBEGIN(GL_LINE_STRIP);
2674 glColor4fv(clearColorArray);
2675 glVertex3f(drawPos.x * innerSize - drawPos.y * width, drawPos.y * innerSize + drawPos.x * width, z1);
2676 GLColorWithOverallAlpha(directionCueColorArray, alpha);
2677 glVertex3f(drawPos.x * outerSize, drawPos.y * outerSize, z1);
2678 glColor4fv(clearColorArray);
2679 glVertex3f(drawPos.x * innerSize + drawPos.y * width, drawPos.y * innerSize - drawPos.x * width, z1);
2680 OOGLEND();
2681 }
2682 }
2683}
@ OO_RETICLE_COLOR_TARGET
@ OO_RETICLE_COLOR_WORMHOLE
OOINLINE Vector vector_flip(Vector v) INLINE_CONST_FUNC
Definition OOVector.h:227
OOINLINE OOScalar dot_product(Vector first, Vector second) INLINE_CONST_FUNC
Definition OOVector.h:299
const Vector kZeroVector
Definition OOVector.m:27
const Vector kBasisXVector
Definition OOVector.h:45
OOINLINE Vector vector_normal(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:270
#define CROSSHAIR_SIZE
Definition Universe.h:58
unsigned isWormhole
Definition Entity.m:175
float alphaComponent()
Definition OOColor.m:442
float blueComponent()
Definition OOColor.m:339
float redComponent()
Definition OOColor.m:329
float greenComponent()
Definition OOColor.m:334

References CachedInfo::alpha, OOColor::alphaComponent, OOColor::blueComponent, CROSSHAIR_SIZE, dot_product(), OOColor::greenComponent, Entity::isWormhole, kBasisXVector, kBasisZVector, kZeroVector, nil, ONE_EIGHTH, OO_RETICLE_COLOR_TARGET, OO_RETICLE_COLOR_WORMHOLE, OOClamp_0_1_f(), OOGLBEGIN, OOGLEND, OOVectorMultiplyMatrix(), OOColor::redComponent, UNIVERSE, vector_flip(), vector_normal(), Vector::x, Vector::y, and Vector::z.

Referenced by HeadUpDisplay(Private)::drawTargetReticle:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawEnergyGauge:

- (void) drawEnergyGauge: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1977 of file HeadUpDisplay.m.

1977 :(NSDictionary*)info
1978{
1979 int x, y;
1980 unsigned i;
1981 NSSize siz;
1982 BOOL drawSurround, labelled, energyCritical = NO;
1983 GLfloat alpha = overallAlpha;
1984 GLfloat bankHeight, bankY;
1985 PlayerEntity* player = PLAYER;
1986
1987 unsigned n_bars = [player dialMaxEnergy] / 64.0;
1988 n_bars = [info oo_unsignedIntForKey:N_BARS_KEY defaultValue:n_bars];
1989 if (n_bars < 1) {
1990 n_bars = 1;
1991 }
1992 GLfloat energy = [player dialEnergy] * n_bars;
1993 struct CachedInfo cached;
1994
1995 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1996
1997 x = useDefined(cached.x, ENERGY_GAUGE_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1998 y = useDefined(cached.y, ENERGY_GAUGE_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2000 siz.height = useDefined(cached.height, ENERGY_GAUGE_HEIGHT);
2001 alpha *= cached.alpha;
2002 drawSurround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ENERGY_GAUGE_DRAW_SURROUND];
2003 labelled = [info oo_boolForKey:LABELLED_KEY defaultValue:YES];
2004 if (n_bars > 8)
2005 labelled = NO;
2006
2007 if (drawSurround) {
2008 // draw energy surround
2010 hudDrawSurroundAt(x, y, z1, siz);
2011 }
2012
2013 bankHeight = siz.height / n_bars;
2014 // draw energy banks
2015 NSSize barSize = NSMakeSize(siz.width, bankHeight - 2.0); // leave a gap between bars
2016 GLfloat midBank = bankHeight / 2.0f;
2017 bankY = y - (n_bars - 1) * midBank - 1.0;
2018
2019 // avoid constant colour switching...
2020 if (labelled) {
2022 GLfloat labelStartX = x + 0.5f * barSize.width + 3.0f;
2023 NSSize labelSize = NSMakeSize(9.0, (bankHeight < 18.0) ? bankHeight : 18.0);
2024 for (i = 0; i < n_bars; i++) {
2025 OODrawString([NSString stringWithFormat:@"E%x", n_bars - i], labelStartX, bankY - midBank, z1, labelSize);
2026 bankY += bankHeight;
2027 }
2028 }
2029
2030 if (energyCritical) {
2032 } else {
2034 }
2035 bankY = y - (n_bars - 1) * midBank;
2036 for (i = 0; i < n_bars; i++) {
2037 if (energy > 1.0) {
2038 hudDrawBarAt(x, bankY, z1, barSize, 1.0);
2039 } else if (energy > 0.0) {
2040 hudDrawBarAt(x, bankY, z1, barSize, energy);
2041 }
2042
2043 energy -= 1.0;
2044 bankY += bankHeight;
2045 }
2046}
#define ENERGY_GAUGE_CENTRE_X
void OODrawString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
#define ENERGY_GAUGE_HEIGHT
#define ENERGY_GAUGE_WIDTH
#define ENERGY_GAUGE_CENTRE_Y
static void hudDrawBarAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
GLfloat dialMaxEnergy()

References CachedInfo::alpha, PlayerEntity::dialEnergy, PlayerEntity::dialMaxEnergy, ENERGY_GAUGE_CENTRE_X, ENERGY_GAUGE_CENTRE_Y, ENERGY_GAUGE_HEIGHT, ENERGY_GAUGE_WIDTH, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), OODrawString(), PLAYER, red_color, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawForwardShieldBar:

- (void) drawForwardShieldBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2048 of file HeadUpDisplay.m.

2048 :(NSDictionary*)info
2049{
2050 int x, y;
2051 NSSize siz;
2052 BOOL draw_surround;
2053 GLfloat alpha = overallAlpha;
2054 GLfloat shield = [PLAYER dialForwardShield];
2055 struct CachedInfo cached;
2056
2057 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2058
2059 x = useDefined(cached.x, FORWARD_SHIELD_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2060 y = useDefined(cached.y, FORWARD_SHIELD_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2062 siz.height = useDefined(cached.height, FORWARD_SHIELD_BAR_HEIGHT);
2063 alpha *= cached.alpha;
2064 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:FORWARD_SHIELD_BAR_DRAW_SURROUND];
2065
2066 if (draw_surround) {
2067 // draw forward_shield surround
2069 hudDrawSurroundAt(x, y, z1, siz);
2070 }
2071 // draw forward_shield bar
2072 if (shield < .25) {
2074 } else if (shield < .80) {
2076 } else {
2078 }
2079 hudDrawBarAt(x, y, z1, siz, shield);
2080}
#define FORWARD_SHIELD_BAR_HEIGHT
#define FORWARD_SHIELD_BAR_WIDTH
#define FORWARD_SHIELD_BAR_CENTRE_Y
#define FORWARD_SHIELD_BAR_CENTRE_X

References CachedInfo::alpha, FORWARD_SHIELD_BAR_CENTRE_X, FORWARD_SHIELD_BAR_CENTRE_Y, FORWARD_SHIELD_BAR_HEIGHT, FORWARD_SHIELD_BAR_WIDTH, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawFPSInfoCounter:

- (void) drawFPSInfoCounter: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2821 of file HeadUpDisplay.m.

2821 :(NSDictionary*)info
2822{
2823 if (![UNIVERSE displayFPS])
2824 return;
2825
2826 int x, y;
2827 NSSize siz;
2828 struct CachedInfo cached;
2829 GLfloat textColor[4] = { 0.0, 1.0, 0.0, 1.0 };
2830
2831 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2832
2833 x = useDefined(cached.x, FPSINFO_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2834 y = useDefined(cached.y, FPSINFO_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2835 siz.width = useDefined(cached.width, FPSINFO_DISPLAY_WIDTH);
2836 siz.height = useDefined(cached.height, FPSINFO_DISPLAY_HEIGHT);
2837
2838 HPVector playerPos = [PLAYER position];
2839 NSString* positionInfo = [UNIVERSE expressPosition:playerPos inCoordinateSystem:@"pwm"];
2840 positionInfo = [NSString stringWithFormat:@"abs %.2f %.2f %.2f / %@", playerPos.x, playerPos.y, playerPos.z, positionInfo];
2841
2842 // We would normally set a variable alpha value here, but in this case we don't.
2843 // We prefer the FPS counter to be always visible - Nikos 20100405
2844 GetRGBAArrayFromInfo(info, textColor);
2845 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], 1.0f));
2846 OODrawString([PLAYER dial_fpsinfo], x, y, z1, siz);
2847
2848#ifndef NDEBUG
2849 NSSize siz08 = NSMakeSize(0.8 * siz.width, 0.8 * siz.width);
2850 NSString* collDebugInfo = [NSString stringWithFormat:@"%@ - %@", [PLAYER dial_objinfo], [UNIVERSE collisionDescription]];
2851 OODrawString(collDebugInfo, x, y - siz.height, z1, siz);
2852
2853 OODrawString(positionInfo, x, y - 1.8 * siz.height, z1, siz08);
2854
2855 NSString* timeAccelerationFactorInfo = [NSString stringWithFormat:@"TAF: %@%.2f", DESC(@"multiplication-sign"), [UNIVERSE timeAccelerationFactor]];
2856 OODrawString(timeAccelerationFactorInfo, x, y - 3.2 * siz08.height, z1, siz08);
2857#endif
2858}
#define FPSINFO_DISPLAY_Y
#define FPSINFO_DISPLAY_WIDTH
#define FPSINFO_DISPLAY_HEIGHT
#define FPSINFO_DISPLAY_X
struct HPVector HPVector

References FPSINFO_DISPLAY_HEIGHT, FPSINFO_DISPLAY_WIDTH, FPSINFO_DISPLAY_X, FPSINFO_DISPLAY_Y, GetRGBAArrayFromInfo(), CachedInfo::height, OODrawString(), OOGL, PLAYER, UNIVERSE, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawFuelBar:

- (void) drawFuelBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2116 of file HeadUpDisplay.m.

2116 :(NSDictionary*)info
2117{
2118 int x, y;
2119 NSSize siz;
2120 BOOL draw_surround;
2121 float fu, hr;
2122 GLfloat alpha = overallAlpha;
2123 struct CachedInfo cached;
2124
2125 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2126
2127 x = useDefined(cached.x, FUEL_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2128 y = useDefined(cached.y, FUEL_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2129 siz.width = useDefined(cached.width, FUEL_BAR_WIDTH);
2130 siz.height = useDefined(cached.height, FUEL_BAR_HEIGHT);
2131 alpha *= cached.alpha;
2132 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2133
2134 if (draw_surround) {
2136 hudDrawSurroundAt(x, y, z1, siz);
2137 }
2138
2139 fu = [PLAYER dialFuel];
2140 hr = [PLAYER dialHyperRange];
2141
2142 // draw fuel bar
2144 hudDrawBarAt(x, y, z1, siz, fu);
2145
2146 // draw range indicator
2147 if (hr > 0.0f && hr <= 1.0f) {
2148 if ([PLAYER hasSufficientFuelForJump]) {
2150 } else {
2152 }
2153 hudDrawMarkerAt(x, y, z1, siz, hr);
2154 }
2155}
#define FUEL_BAR_CENTRE_Y
#define FUEL_BAR_CENTRE_X
#define FUEL_BAR_HEIGHT
#define FUEL_BAR_WIDTH
static void hudDrawMarkerAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)

References CachedInfo::alpha, FUEL_BAR_CENTRE_X, FUEL_BAR_CENTRE_Y, FUEL_BAR_HEIGHT, FUEL_BAR_WIDTH, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawMarkerAt(), hudDrawSurroundAt(), PLAYER, red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawGreenSurround:

- (void) drawGreenSurround: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3048 of file HeadUpDisplay.m.

3048 :(NSDictionary*)info
3049{
3050 [self drawSurroundInternal:info color:green_color];
3051}

References drawSurroundInternal:color:.

Here is the call graph for this function:

◆ drawHighlight

- (void) drawHighlight (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(GLfloat) alpha 
implementation

Definition at line 3647 of file HeadUpDisplay.m.

3648{
3649 // Rounded corners, fading 'shadow' version
3650 OOGL(glColor4f(0.0f, 0.0f, 0.0f, alpha * 0.4f)); // dark translucent shadow
3651
3652 OOGLBEGIN(GL_POLYGON);
3653 // thin 'halo' around the 'solid' highlight
3654 glVertex3f(x + 1.0f, y + siz.height + 2.5f, z);
3655 glVertex3f(x + siz.width + 3.0f, y + siz.height + 2.5f, z);
3656 glVertex3f(x + siz.width + 4.5f, y + siz.height + 1.0f, z);
3657 glVertex3f(x + siz.width + 4.5f, y + 3.0f, z);
3658 glVertex3f(x + siz.width + 3.0f, y + 1.5f, z);
3659 glVertex3f(x + 1.0f, y + 1.5f, z);
3660 glVertex3f(x - 0.5f, y + 3.0f, z);
3661 glVertex3f(x - 0.5f, y + siz.height + 1.0f, z);
3662 OOGLEND();
3663
3664 OOGLBEGIN(GL_POLYGON);
3665 glVertex3f(x + 1.0f, y + siz.height + 2.0f, z);
3666 glVertex3f(x + siz.width + 3.0f, y + siz.height + 2.0f, z);
3667 glVertex3f(x + siz.width + 4.0f, y + siz.height + 1.0f, z);
3668 glVertex3f(x + siz.width + 4.0f, y + 3.0f, z);
3669 glVertex3f(x + siz.width + 3.0f, y + 2.0f, z);
3670 glVertex3f(x + 1.0f, y + 2.0f, z);
3671 glVertex3f(x, y + 3.0f, z);
3672 glVertex3f(x, y + siz.height + 1.0f, z);
3673 OOGLEND();
3674}

References OOGL, OOGLBEGIN, OOGLEND, x, and y.

Referenced by OODrawHilightedPlanetInfo, and OODrawHilightedString.

Here is the caller graph for this function:

◆ drawHUDItem:

- (void) drawHUDItem: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 992 of file HeadUpDisplay.m.

992 :(NSDictionary*)info
993{
994 NSString* equipment = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
995
996 if (equipment != nil && ![PLAYER hasEquipmentItemProviding:equipment]) {
997 return;
998 }
999
1000 // check alert condition
1001 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1002 // 1=docked, 2=green, 4=yellow, 8=red
1003 if (alertMask < 15) {
1004 OOAlertCondition alertCondition = [PLAYER alertCondition];
1005 if (~alertMask & (1 << alertCondition)) {
1006 return;
1007 }
1008 }
1009
1010 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1011
1012 // 1=docked, 2=green, 4=yellow, 8=red
1013 if (viewOnly && [PLAYER guiScreen] != GUI_SCREEN_MAIN) {
1014 return;
1015 }
1016
1017 if (EXPECT_NOT([self hasHidden:[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR_NAME]])) {
1018 return;
1019 }
1020
1021 // use the selector value stored during init.
1022 [self performSelector:[(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR] pointerValue] withObject:info];
1023 OOCheckOpenGLErrors(@"HeadUpDisplay after drawHUDItem %@", info);
1024
1026}
#define WIDGET_SELECTOR_NAME
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:133
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
OOAlertCondition
Definition ShipEntity.h:166

References EXPECT_NOT, nil, OOCheckOpenGLErrors(), OOVerifyOpenGLState, PLAYER, sCurrentDrawItem, and WIDGET_SELECTOR_NAME.

Referenced by HeadUpDisplay(Private)::drawDials.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawIconForEmptyPylonAtX:y:width:height:alpha:

- (void) drawIconForEmptyPylonAtX: (int) x
y: (int) y
width: (GLfloat) width
height: (GLfloat) height
alpha: (GLfloat) alpha 
implementation

Definition at line 2404 of file HeadUpDisplay.m.

2404 :(int)x y:(int)y
2405 width:(GLfloat)width
2406 height:(GLfloat)height
2407 alpha:(GLfloat)alpha
2408{
2409 OOPolygonSprite* sprite = IconForMissileRole(kDefaultMissileIconKey);
2410
2411 // Draw gray outline.
2413 OOGLTranslateModelView(make_vector(x - width * 2.0f, y - height * 2.0f, z1));
2414 OOGLScaleModelView(make_vector(width, height, 1.0f));
2416 [sprite drawOutline];
2418}
static NSString *const kDefaultMissileIconKey
static const GLfloat lightgray_color[4]
static OOPolygonSprite * IconForMissileRole(NSString *role)

References GLColorWithOverallAlpha, IconForMissileRole, kDefaultMissileIconKey, lightgray_color, make_vector(), OOGLPopModelView(), OOGLPushModelView(), OOGLScaleModelView(), OOGLTranslateModelView(), x, y, and z1.

Referenced by HeadUpDisplay(Private)::drawMissileDisplay:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawIconForMissile:selected:status:x:y:width:height:alpha:

- (void) drawIconForMissile: (ShipEntity*) missile
selected: (BOOL) selected
status: (OOMissileStatus) status
x: (int) x
y: (int) y
width: (GLfloat) width
height: (GLfloat) height
alpha: (GLfloat) alpha 
implementation

Definition at line 2351 of file HeadUpDisplay.m.

2351 :(ShipEntity*)missile
2352 selected:(BOOL)selected
2353 status:(OOMissileStatus)status
2354 x:(int)x
2355 y:(int)y
2356 width:(GLfloat)width
2357 height:(GLfloat)height
2358 alpha:(GLfloat)alpha
2359{
2360 OOPolygonSprite* sprite = IconForMissileRole([missile primaryRole]);
2361
2362 if (selected) {
2363 // Draw yellow outline.
2365 OOGLTranslateModelView(make_vector(x - width * 2.0f, y - height * 2.0f, z1));
2366 OOGLScaleModelView(make_vector(width, height, 1.0f));
2368 [sprite drawOutline];
2370
2371 // Draw black backing, so outline colour isn’t blended into missile colour.
2373 OOGLTranslateModelView(make_vector(x - width * 2.0f, y - height * 2.0f, z1));
2374 OOGLScaleModelView(make_vector(width, height, 1.0f));
2376 [sprite drawFilled];
2378
2379 switch (status) {
2382 break;
2385 break;
2388 break;
2389 }
2390 } else {
2391 if ([missile primaryTarget] == nil)
2393 else
2395 }
2396
2398 OOGLTranslateModelView(make_vector(x - width * 2.0f, y - height * 2.0f, z1));
2399 OOGLScaleModelView(make_vector(width, height, 1.0f));
2400 [sprite drawFilled];
2402}
static const GLfloat black_color[4]
OOMissileStatus
@ MISSILE_STATUS_TARGET_LOCKED
@ MISSILE_STATUS_ARMED
@ MISSILE_STATUS_SAFE

References black_color, GLColorWithOverallAlpha, green_color, IconForMissileRole, make_vector(), MISSILE_STATUS_ARMED, MISSILE_STATUS_SAFE, MISSILE_STATUS_TARGET_LOCKED, nil, OOGLPopModelView(), OOGLPushModelView(), OOGLScaleModelView(), OOGLTranslateModelView(), red_color, x, y, yellow_color, and z1.

Referenced by HeadUpDisplay(Private)::drawMissileDisplay:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawLegend:

- (void) drawLegend: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 929 of file HeadUpDisplay.m.

929 :(NSDictionary*)info
930{
931 // check if equipment is required
932 NSString* equipmentRequired = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
933 if (equipmentRequired != nil && ![PLAYER hasEquipmentItemProviding:equipmentRequired]) {
934 return;
935 }
936
937 // check alert condition
938 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
939 // 1=docked, 2=green, 4=yellow, 8=red
940 if (alertMask < 15) {
941 OOAlertCondition alertCondition = [PLAYER alertCondition];
942 if (~alertMask & (1 << alertCondition)) {
943 return;
944 }
945 }
946
947 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
948 // 1=docked, 2=green, 4=yellow, 8=red
949 if (viewOnly && [PLAYER guiScreen] != GUI_SCREEN_MAIN) {
950 return;
951 }
952
953 // check association with hidden dials
954 if ([self hasHidden:[info oo_stringForKey:DIAL_REQUIRED_KEY defaultValue:nil]]) {
955 return;
956 }
957
958 OOTextureSprite* legendSprite = nil;
959 NSString* legendText = nil;
960 float x, y;
961 NSSize size;
962 GLfloat alpha = overallAlpha;
963 struct CachedInfo cached;
964
965 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
966
967 // if either x or y is missing, use 0 instead
968
969 x = useDefined(cached.x, 0.0f) + [[UNIVERSE gameView] x_offset] * cached.x0;
970 y = useDefined(cached.y, 0.0f) + [[UNIVERSE gameView] y_offset] * cached.y0;
971 alpha *= cached.alpha;
972
973 legendSprite = [info objectForKey:SPRITE_KEY];
974 if (legendSprite != nil) {
975 [legendSprite blitCentredToX:x Y:y Z:z1 alpha:alpha];
976 } else {
977 legendText = [info oo_stringForKey:TEXT_KEY];
978 if (legendText != nil) {
979 // randomly chosen default width & height
980 size.width = useDefined(cached.width, 14.0f);
981 size.height = useDefined(cached.height, 8.0f);
983 if ([info oo_intForKey:@"align"] == 1) {
984 OODrawStringAligned(legendText, x, y, z1, size, YES);
985 } else {
986 OODrawStringAligned(legendText, x, y, z1, size, NO);
987 }
988 }
989 }
990}
#define DIAL_REQUIRED_KEY

References CachedInfo::alpha, OOTextureSprite::blitCentredToX:Y:Z:alpha:, DIAL_REQUIRED_KEY, green_color, CachedInfo::height, nil, OODrawStringAligned(), PLAYER, SET_COLOR, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Referenced by HeadUpDisplay(Private)::drawLegends.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawLegends

- (void) drawLegends
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 779 of file HeadUpDisplay.m.

780{
781 /* Since the order of legend drawing is significant, this loop must be kept
782 * as an incrementing one for compatibility with previous Oolite versions.
783 * CIM: 28/9/12 */
784 z1 = [[UNIVERSE gameView] display_z];
785 NSUInteger i, nLegends = [legendArray count];
786 for (i = 0; i < nLegends; i++) {
787 sCurrentDrawItem = [legendArray oo_arrayAtIndex:i];
788 [self drawLegend:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
789 }
790}

References drawLegend:, HeadUpDisplay(Private)::drawLegends, and sCurrentDrawItem.

Referenced by HeadUpDisplay(Private)::drawLegends, and renderHUD.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawMFDs

- (void) drawMFDs
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 813 of file HeadUpDisplay.m.

814{
815 NSUInteger i, nMFDs = [mfdArray count];
816 NSString* text = nil;
817 for (i = 0; i < nMFDs; i++) {
818 text = [PLAYER multiFunctionText:i];
819 if (text != nil) {
820 sCurrentDrawItem = [mfdArray oo_arrayAtIndex:i];
821 [self drawMultiFunctionDisplay:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO] withText:text asIndex:i];
822 }
823 }
824}

References HeadUpDisplay(Private)::drawMFDs, drawMultiFunctionDisplay:withText:asIndex:, nil, and sCurrentDrawItem.

Referenced by HeadUpDisplay(Private)::drawMFDs, and renderHUD.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawMissileDisplay:

- (void) drawMissileDisplay: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2420 of file HeadUpDisplay.m.

2420 :(NSDictionary*)info
2421{
2422 int x, y, sp;
2423 NSSize siz;
2424 GLfloat alpha = overallAlpha;
2425 struct CachedInfo cached;
2426
2427 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2428
2429 x = useDefined(cached.x, MISSILES_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2430 y = useDefined(cached.y, MISSILES_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2432 siz.height = useDefined(cached.height, MISSILE_ICON_HEIGHT);
2433 alpha *= cached.alpha;
2434 sp = [info oo_unsignedIntForKey:SPACING_KEY defaultValue:MISSILES_DISPLAY_SPACING];
2435
2436 BOOL weaponsOnline = [PLAYER weaponsOnline];
2437 if (!weaponsOnline)
2438 alpha *= 0.2f; // darken missile display if weapons are offline
2439
2440 if (![PLAYER dialIdentEngaged]) {
2441 OOMissileStatus status = [PLAYER dialMissileStatus];
2442 NSUInteger i, n_mis = [PLAYER dialMaxMissiles];
2443 for (i = 0; i < n_mis; i++) {
2444 ShipEntity* missile = [PLAYER missileForPylon:i];
2445 if (missile) {
2446 [self drawIconForMissile:missile
2447 selected:weaponsOnline && i == [PLAYER activeMissile]
2448 status:status
2449 x:x + (int)i * sp + 2
2450 y:y
2451 width:siz.width * 0.25f
2452 height:siz.height * 0.25f
2453 alpha:alpha];
2454 } else {
2455 [self drawIconForEmptyPylonAtX:x + (int)i * sp + 2
2456 y:y
2457 width:siz.width * 0.25f
2458 height:siz.height * 0.25f
2459 alpha:alpha];
2460 }
2461 }
2462 } else {
2463 x -= siz.width;
2464 y -= siz.height * 0.75;
2465 siz.width *= 0.80;
2466 sp *= 0.75;
2467 switch ([PLAYER dialMissileStatus]) {
2470 break;
2473 break;
2476 break;
2477 }
2478 OOGLBEGIN(GL_QUADS);
2479 glVertex3i(x, y, z1);
2480 glVertex3i(x + siz.width, y, z1);
2481 glVertex3i(x + siz.width, y + siz.height, z1);
2482 glVertex3i(x, y + siz.height, z1);
2483 OOGLEND();
2485 OODrawString([PLAYER dialTargetName], x + sp, y - 1, z1, NSMakeSize(siz.width, siz.height));
2486 }
2487}
#define MISSILE_ICON_WIDTH
#define MISSILES_DISPLAY_Y
#define MISSILES_DISPLAY_X
#define MISSILE_ICON_HEIGHT

References CachedInfo::alpha, drawIconForEmptyPylonAtX:y:width:height:alpha:, drawIconForMissile:selected:status:x:y:width:height:alpha:, green_color, CachedInfo::height, MISSILE_ICON_HEIGHT, MISSILE_ICON_WIDTH, MISSILE_STATUS_ARMED, MISSILE_STATUS_SAFE, MISSILE_STATUS_TARGET_LOCKED, MISSILES_DISPLAY_X, MISSILES_DISPLAY_Y, OODrawString(), OOGLBEGIN, OOGLEND, PLAYER, red_color, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawMultiFunctionDisplay:withText:asIndex:

- (void) drawMultiFunctionDisplay: (NSDictionary*) info
withText: (NSString*) text
asIndex: (NSUInteger) index 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3068 of file HeadUpDisplay.m.

3068 :(NSDictionary*)info withText:(NSString*)text asIndex:(NSUInteger)index
3069{
3070 PlayerEntity* player1 = PLAYER;
3071 struct CachedInfo cached;
3072 NSInteger i, x, y;
3073 NSSize siz, tmpsiz;
3074 if ([player1 guiScreen] != GUI_SCREEN_MAIN) // don't draw on text screens
3075 {
3076 return;
3077 }
3078 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
3079
3080 GLfloat mfd_color[4] = { 0.0, 1.0, 0.0, 0.9 * alpha };
3081 OOColor* mfdcol = [OOColor colorWithDescription:[info objectForKey:COLOR_KEY]];
3082 if (mfdcol != nil) {
3083 [mfdcol getRed:&mfd_color[0] green:&mfd_color[1] blue:&mfd_color[2] alpha:&mfd_color[3]];
3084 }
3085 if (index != [player1 activeMFD]) {
3086 mfd_color[3] *= 0.75;
3087 }
3088 [self drawSurroundInternal:info color:mfd_color];
3089
3090 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3091 x = cached.x + [[UNIVERSE gameView] x_offset] * cached.x0;
3092 y = cached.y + [[UNIVERSE gameView] y_offset] * cached.y0;
3093
3094 siz.width = useDefined(cached.width / 15, MFD_TEXT_WIDTH);
3095 siz.height = useDefined(cached.height / 10, MFD_TEXT_HEIGHT);
3096
3097 GLfloat x0 = (GLfloat)(x - cached.width / 2);
3098 GLfloat y0 = (GLfloat)(y + cached.height / 2);
3099 GLfloat x1 = (GLfloat)(x + cached.width / 2);
3100 GLfloat y1 = (GLfloat)(y - cached.height / 2);
3101 GLColorWithOverallAlpha(mfd_color, alpha * 0.3);
3102 OOGLBEGIN(GL_QUADS);
3103 glVertex3f(x0 - 2, y0 + 2, z1);
3104 glVertex3f(x0 - 2, y1 - 2, z1);
3105 glVertex3f(x1 + 2, y1 - 2, z1);
3106 glVertex3f(x1 + 2, y0 + 2, z1);
3107 OOGLEND();
3108
3109 NSString* line = nil;
3110 NSArray* lines = [text componentsSeparatedByString:@"\n"];
3111 // text at full opacity
3112 GLColorWithOverallAlpha(mfd_color, alpha);
3113 for (i = 0; i < 10; i++) {
3114 line = [lines oo_stringAtIndex:i defaultValue:nil];
3115 if (line != nil) {
3116 y0 -= siz.height;
3117 // all lines should be shorter than the size of the MFD
3118 GLfloat textwidth = OORectFromString(line, 0.0f, 0.0f, siz).size.width;
3119 if (textwidth <= cached.width) {
3120 OODrawString(line, x0, y0, z1, siz);
3121 } else {
3122 // compress it so it fits
3123 tmpsiz.height = siz.height;
3124 tmpsiz.width = siz.width * cached.width / textwidth;
3125 OODrawString(line, x0, y0, z1, tmpsiz);
3126 }
3127 } else {
3128 break;
3129 }
3130 }
3131}
#define MFD_TEXT_WIDTH
NSRect OORectFromString(NSString *text, GLfloat x, GLfloat y, NSSize siz)
#define MFD_TEXT_HEIGHT
OOColor * colorWithDescription:(id description)
Definition OOColor.m:135

References OOColor::colorWithDescription:, drawSurroundInternal:color:, OOColor::getRed:green:blue:alpha:, CachedInfo::height, MFD_TEXT_HEIGHT, MFD_TEXT_WIDTH, nil, OODrawString(), OOGLBEGIN, OOGLEND, OORectFromString(), PLAYER, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Referenced by HeadUpDisplay(Private)::drawMFDs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawPitchBar:

- (void) drawPitchBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1922 of file HeadUpDisplay.m.

1922 :(NSDictionary*)info
1923{
1924 int x, y;
1925 NSSize siz;
1926 BOOL draw_surround;
1927 GLfloat alpha = overallAlpha;
1928 struct CachedInfo cached;
1929
1930 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1931
1932 x = useDefined(cached.x, PITCH_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1933 y = useDefined(cached.y, PITCH_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1934 siz.width = useDefined(cached.width, PITCH_BAR_WIDTH);
1935 siz.height = useDefined(cached.height, PITCH_BAR_HEIGHT);
1936 alpha *= cached.alpha;
1937 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
1938
1939 if (draw_surround) {
1940 // draw PITCH surround
1942 hudDrawSurroundAt(x, y, z1, siz);
1943 }
1944 // draw PITCH bar
1946 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialPitch]);
1947}
#define PITCH_BAR_CENTRE_Y
#define PITCH_BAR_CENTRE_X
#define PITCH_BAR_HEIGHT
#define PITCH_BAR_WIDTH

References CachedInfo::alpha, green_color, CachedInfo::height, hudDrawIndicatorAt(), hudDrawSurroundAt(), PITCH_BAR_CENTRE_X, PITCH_BAR_CENTRE_Y, PITCH_BAR_HEIGHT, PITCH_BAR_WIDTH, PLAYER, SET_COLOR, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawPrimedEquipment:

- (void) drawPrimedEquipment: (NSDictionary*) info
implementation

Definition at line 2706 of file HeadUpDisplay.m.

2706 :(NSDictionary*)info
2707{
2708 if ([PLAYER status] == STATUS_DOCKED) {
2709 // Can't activate equipment while docked
2710 return;
2711 }
2712
2713 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2714 struct CachedInfo cached;
2715
2716 NSUInteger lines = [info oo_intForKey:@"n_bars" defaultValue:1];
2717 NSInteger pec = (NSInteger)[PLAYER primedEquipmentCount];
2718
2719 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2720
2721 NSInteger x = useDefined(cached.x, PRIMED_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2722 NSInteger y = useDefined(cached.y, PRIMED_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2723
2724 NSSize size = {
2725 .width = useDefined(cached.width, PRIMED_DISPLAY_WIDTH),
2726 .height = useDefined(cached.height, PRIMED_DISPLAY_HEIGHT)
2727 };
2728
2729 if (pec == 0) {
2730 // Don't display if no primed equipment fitted
2731 return;
2732 }
2733
2734 GetRGBAArrayFromInfo(info, itemColor);
2735 itemColor[3] *= overallAlpha;
2736
2737 if (lines == 1) {
2738 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2739 NSString* equipmentName = [PLAYER primedEquipmentName:0];
2740 OODrawString(OOExpandKey(@"equipment-primed-hud", equipmentName), x, y, z1, size);
2741 } else {
2742 NSInteger negative = (lines - 1) / 2;
2743 NSInteger positive = lines / 2;
2744 for (NSInteger i = -negative; i <= positive; i++) {
2745 if (i >= -(pec) / 2 && i <= (pec + 1) / 2) {
2746 // don't display loops if we have more equipment than lines
2747 // instead compact the display towards its centre
2748 GLfloat alphaScale = 1.0 / ((i < 0) ? (1.0 - i) : (1.0 + i));
2749 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3] * alphaScale));
2750 OODrawString([PLAYER primedEquipmentName:i], x, y, z1, size);
2751 }
2752 y -= size.height;
2753 }
2754 }
2755}
#define PRIMED_DISPLAY_WIDTH
#define PRIMED_DISPLAY_X
#define PRIMED_DISPLAY_HEIGHT
#define PRIMED_DISPLAY_Y
#define OOExpandKey(key,...)

References GetRGBAArrayFromInfo(), CachedInfo::height, OODrawString(), OOExpandKey, OOGL, overallAlpha, PLAYER, PRIMED_DISPLAY_HEIGHT, PRIMED_DISPLAY_WIDTH, PRIMED_DISPLAY_X, PRIMED_DISPLAY_Y, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and z1.

Here is the call graph for this function:

◆ drawPrimedEquipmentText:

- (void) drawPrimedEquipmentText: (NSDictionary *) info
implementation

Provided by category HeadUpDisplay(Private).

◆ drawRollBar:

- (void) drawRollBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1895 of file HeadUpDisplay.m.

1895 :(NSDictionary*)info
1896{
1897 int x, y;
1898 NSSize siz;
1899 BOOL draw_surround;
1900 GLfloat alpha = overallAlpha;
1901 struct CachedInfo cached;
1902
1903 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1904
1905 x = useDefined(cached.x, ROLL_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1906 y = useDefined(cached.y, ROLL_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1907 siz.width = useDefined(cached.width, ROLL_BAR_WIDTH);
1908 siz.height = useDefined(cached.height, ROLL_BAR_HEIGHT);
1909 alpha *= cached.alpha;
1910 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ROLL_BAR_DRAW_SURROUND];
1911
1912 if (draw_surround) {
1913 // draw ROLL surround
1915 hudDrawSurroundAt(x, y, z1, siz);
1916 }
1917 // draw ROLL bar
1919 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialRoll]);
1920}
#define ROLL_BAR_CENTRE_Y
#define ROLL_BAR_WIDTH
#define ROLL_BAR_HEIGHT
#define ROLL_BAR_CENTRE_X

References CachedInfo::alpha, green_color, CachedInfo::height, hudDrawIndicatorAt(), hudDrawSurroundAt(), PLAYER, ROLL_BAR_CENTRE_X, ROLL_BAR_CENTRE_Y, ROLL_BAR_HEIGHT, ROLL_BAR_WIDTH, SET_COLOR, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawScanner:

- (void) drawScanner: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1056 of file HeadUpDisplay.m.

1056 :(NSDictionary*)info
1057{
1058 int i, x, y;
1059 NSSize siz;
1060 GLfloat scanner_color[4] = { 1.0, 0.0, 0.0, 1.0 };
1061
1062 BOOL emptyDial = ([info oo_floatForKey:ALPHA_KEY] == 0.0f);
1063
1064 BOOL isHostile = NO;
1065
1066 BOOL inColorBlindMode = [UNIVERSE colorblindMode] != OO_POSTFX_NONE;
1067
1068 if (emptyDial) {
1069 // we can skip a lot of code.
1070 x = y = 0;
1071 scanner_color[3] = 0.0; // nothing to see!
1072 siz = NSMakeSize(1.0, 1.0); // avoid divide by 0s
1073 } else {
1074 struct CachedInfo cached;
1075
1076 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1077
1078 x = useDefined(cached.x, SCANNER_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1079 y = useDefined(cached.y, SCANNER_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1080 siz.width = useDefined(cached.width, SCANNER_WIDTH);
1081 siz.height = useDefined(cached.height, SCANNER_HEIGHT);
1082
1083 GetRGBAArrayFromInfo(info, scanner_color);
1084
1085 scanner_color[3] *= overallAlpha;
1086 }
1087
1088 GLfloat alpha = scanner_color[3];
1089 GLfloat col[4] = { 1.0, 1.0, 1.0, alpha }; // temporary colour variable
1090
1091 GLfloat z_factor = siz.height / siz.width; // approx 1/4
1092 GLfloat y_factor = 1.0 - sqrt(z_factor); // approx 1/2
1093
1094 int scanner_cx = x;
1095 int scanner_cy = y;
1096
1097 int scannerFootprint = SCANNER_MAX_RANGE * 2.5 / siz.width;
1098
1099 GLfloat zoom = scanner_zoom;
1101 zoom = pow(2, zoom - 1.0);
1102 GLfloat max_zoomed_range2 = SCANNER_SCALE * SCANNER_SCALE * 10000.0;
1103 if (!nonlinear_scanner) {
1104 max_zoomed_range2 /= zoom * zoom;
1105 }
1106 GLfloat max_zoomed_range = sqrt(max_zoomed_range2);
1107
1108 if (PLAYER == nil)
1109 return;
1110
1111 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1112 Vector relativePosition;
1113 int flash = ((int)([UNIVERSE getTime] * 4)) & 1;
1114
1115 // use a non-mutable copy so this can't be changed under us.
1116 int ent_count = UNIVERSE->n_entities;
1117 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
1118 Entity* my_entities[ent_count];
1119 Entity* scannedEntity = nil;
1120
1121 for (i = 0; i < ent_count; i++) {
1122 my_entities[i] = [uni_entities[i] retain]; // retained
1123 }
1124
1125 if (!emptyDial) {
1126 OOGL(glColor4fv(scanner_color));
1128 }
1129
1130 if ([self checkPlayerInFlight]) {
1131 GLfloat upscale = zoom * 1.25 / scannerFootprint;
1132 GLfloat max_blip = 0.0;
1133 int drawClass;
1134
1136
1137 // Debugging code for nonlinear scanner - draws three fake cascade weapons, which looks pretty and enables me
1138 // to debug the code without the mass slaughter of innocent civillians.
1139 // if (nonlinear_scanner)
1140 //{
1141 // Vector p = OOVectorMultiplyMatrix(make_vector(10000.0, 0.0, 0.0), rotMatrix);
1142 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 5000, zoom, alpha );
1143 // p = OOVectorMultiplyMatrix(make_vector(10000.0, 4500.0, 0.0), rotMatrix);
1144 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 2000, zoom, alpha );
1145 // p = OOVectorMultiplyMatrix(make_vector(0.0, 0.0, 20000.0), rotMatrix);
1146 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 6000, zoom, alpha );
1147 //}
1148 for (i = 0; i < ent_count; i++) // scanner lollypops
1149 {
1150 scannedEntity = my_entities[i];
1151
1152 drawClass = [scannedEntity scanClass];
1153
1154 // cloaked ships - and your own one - don't show up on the scanner.
1155 if (EXPECT_NOT(drawClass == CLASS_PLAYER || ([scannedEntity isShip] && [(ShipEntity*)scannedEntity isCloaked]))) {
1156 drawClass = CLASS_NO_DRAW;
1157 }
1158
1159 if (drawClass != CLASS_NO_DRAW) {
1160 GLfloat x1, y1, y2;
1161 float ms_blip = 0.0;
1162
1163 if (emptyDial)
1164 continue;
1165
1166 if (isnan(scannedEntity->zero_distance))
1167 continue;
1168
1169 // exit if it's too far away
1170 GLfloat act_dist = sqrt(scannedEntity->zero_distance);
1171 GLfloat lim_dist = act_dist - scannedEntity->collision_radius;
1172
1173 // for efficiency, assume no scannable entity > 10km radius
1174 if (act_dist > max_zoomed_range + 10000.0)
1175 break;
1176
1177 if (lim_dist > max_zoomed_range)
1178 continue;
1179
1180 // has it sent a recent message
1181 //
1182 if ([scannedEntity isShip])
1183 ms_blip = 2.0 * [(ShipEntity*)scannedEntity messageTime];
1184 if (ms_blip > max_blip) {
1185 max_blip = ms_blip;
1186 last_transmitter = [scannedEntity universalID];
1187 }
1188 ms_blip -= floor(ms_blip);
1189
1190 relativePosition = [PLAYER vectorTo:scannedEntity];
1191 double fuzz = [PLAYER scannerFuzziness];
1192 if (fuzz > 0 && ![[UNIVERSE gameController] isGamePaused]) {
1193 relativePosition = vector_add(relativePosition, OOVectorRandomRadial(fuzz));
1194 }
1195
1196 Vector rp = relativePosition;
1197
1198 if (act_dist > max_zoomed_range)
1199 scale_vector(&relativePosition, max_zoomed_range / act_dist);
1200
1201 // rotate the view
1202 relativePosition = OOVectorMultiplyMatrix(relativePosition, rotMatrix);
1203 Vector rrp = relativePosition;
1204 // scale the view
1205 if (nonlinear_scanner) {
1206 relativePosition = [HeadUpDisplay nonlinearScannerScale:relativePosition Zoom:zoom Scale:0.5 * siz.width];
1207 } else {
1208 scale_vector(&relativePosition, upscale);
1209 }
1210
1211 x1 = relativePosition.x;
1212 y1 = z_factor * relativePosition.z;
1213 y2 = y1 + y_factor * relativePosition.y;
1214
1215 isHostile = NO;
1216 if ([scannedEntity isShip]) {
1217 ShipEntity* ship = (ShipEntity*)scannedEntity;
1218 isHostile = (([ship hasHostileTarget]) && ([ship primaryTarget] == PLAYER));
1219 GLfloat* base_col = [ship scannerDisplayColorForShip:PLAYER
1220 isHostile:isHostile
1221 flash:flash
1223 scannerDisplayColor2:[ship scannerDisplayColor2]
1224 scannerDisplayColorH1:[ship scannerDisplayColorHostile1]
1225 scannerDisplayColorH2:[ship scannerDisplayColorHostile2]];
1226 col[0] = base_col[0];
1227 col[1] = base_col[1];
1228 col[2] = base_col[2];
1229 col[3] = alpha * base_col[3];
1230 } else if ([scannedEntity isVisualEffect]) {
1231 OOVisualEffectEntity* vis = (OOVisualEffectEntity*)scannedEntity;
1232 GLfloat* base_col = [vis scannerDisplayColorForShip:flash scannerDisplayColor1:[vis scannerDisplayColor1] scannerDisplayColor2:[vis scannerDisplayColor2]];
1233 col[0] = base_col[0];
1234 col[1] = base_col[1];
1235 col[2] = base_col[2];
1236 col[3] = alpha * base_col[3];
1237 }
1238
1239 if ([scannedEntity isWormhole]) {
1240 col[0] = blue_color[0];
1241 col[1] = (flash) ? 1.0 : blue_color[1];
1242 col[2] = blue_color[2];
1243 col[3] = alpha * blue_color[3];
1244 }
1245
1246 // position the scanner
1247 x1 += scanner_cx;
1248 y1 += scanner_cy;
1249 y2 += scanner_cy;
1250
1251 if ([scannedEntity isShip]) {
1252 ShipEntity* ship = (ShipEntity*)scannedEntity;
1253 if ((!nonlinear_scanner && ship->collision_radius * upscale > 4.5) || (nonlinear_scanner && nonlinearScannerFunc(act_dist, zoom, siz.width) - nonlinearScannerFunc(lim_dist, zoom, siz.width) > 4.5)) {
1254 Vector bounds[6];
1255 BoundingBox bb = ship->totalBoundingBox;
1256 bounds[0] = ship->v_forward;
1257 scale_vector(&bounds[0], bb.max.z);
1258 bounds[1] = ship->v_forward;
1259 scale_vector(&bounds[1], bb.min.z);
1260 bounds[2] = ship->v_right;
1261 scale_vector(&bounds[2], bb.max.x);
1262 bounds[3] = ship->v_right;
1263 scale_vector(&bounds[3], bb.min.x);
1264 bounds[4] = ship->v_up;
1265 scale_vector(&bounds[4], bb.max.y);
1266 bounds[5] = ship->v_up;
1267 scale_vector(&bounds[5], bb.min.y);
1268 // rotate the view
1269 int i;
1270 for (i = 0; i < 6; i++) {
1271 bounds[i] = OOVectorMultiplyMatrix(vector_add(bounds[i], rp), rotMatrix);
1272 if (nonlinear_scanner) {
1273 bounds[i] = [HeadUpDisplay nonlinearScannerScale:bounds[i] Zoom:zoom Scale:0.5 * siz.width];
1274 } else {
1275 scale_vector(&bounds[i], upscale);
1276 }
1277 bounds[i] = make_vector(bounds[i].x + scanner_cx, bounds[i].z * z_factor + bounds[i].y * y_factor + scanner_cy, z1);
1278 }
1279 // draw the diamond
1280 //
1281 OOGLBEGIN(GL_QUADS);
1282 glColor4f(col[0], col[1], col[2], 0.33333 * col[3]);
1283 glVertex3f(bounds[0].x, bounds[0].y, bounds[0].z);
1284 glVertex3f(bounds[4].x, bounds[4].y, bounds[4].z);
1285 glVertex3f(bounds[1].x, bounds[1].y, bounds[1].z);
1286 glVertex3f(bounds[5].x, bounds[5].y, bounds[5].z);
1287 glVertex3f(bounds[2].x, bounds[2].y, bounds[2].z);
1288 glVertex3f(bounds[4].x, bounds[4].y, bounds[4].z);
1289 glVertex3f(bounds[3].x, bounds[3].y, bounds[3].z);
1290 glVertex3f(bounds[5].x, bounds[5].y, bounds[5].z);
1291 glVertex3f(bounds[2].x, bounds[2].y, bounds[2].z);
1292 glVertex3f(bounds[0].x, bounds[0].y, bounds[0].z);
1293 glVertex3f(bounds[3].x, bounds[3].y, bounds[3].z);
1294 glVertex3f(bounds[1].x, bounds[1].y, bounds[1].z);
1295 OOGLEND();
1296 }
1297 }
1298
1299 if (ms_blip > 0.0) {
1300 DrawSpecialOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(16.0 * (1.0 - ms_blip), 8.0 * (1.0 - ms_blip)), 30, col);
1301 }
1302 if ([scannedEntity isCascadeWeapon]) {
1303 if (nonlinear_scanner) {
1304 GLDrawNonlinearCascadeWeapon(scanner_cx, scanner_cy, z1, siz, rrp, scannedEntity->collision_radius, zoom, alpha);
1305 } else {
1306 GLfloat r1 = 2.5 + scannedEntity->collision_radius * upscale;
1307 GLfloat l2 = r1 * r1 - relativePosition.y * relativePosition.y;
1308 GLfloat r0 = (l2 > 0) ? sqrt(l2) : 0;
1309 if (r0 > 0) {
1310 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
1311 GLDrawOval(x1 - 0.5, y1 + 1.5, z1, NSMakeSize(r0, r0 * siz.height / siz.width), 20);
1312 }
1313 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
1314 GLDrawFilledOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(r1, r1), 15);
1315 }
1316 } else {
1317
1318#if IDENTIFY_SCANNER_LOLLIPOPS
1319 if ([scannedEntity isShip]) {
1320 glColor4f(1.0, 1.0, 0.5, alpha);
1321 OODrawString([(ShipEntity*)scannedEntity displayName], x1 + 2, y2 + 2, z1, NSMakeSize(8, 8));
1322 }
1323#endif
1324 glColor4fv(col);
1325 if (inColorBlindMode && isHostile) {
1326 // in colorblind mode turn hostile blips into X shapes for easier recognition
1327 OOGLBEGIN(GL_LINES);
1328 glVertex3f(x1 + 2, y2 + 3, z1);
1329 glVertex3f(x1 - 3, y2, z1);
1330 glVertex3f(x1 + 2, y2, z1);
1331 glVertex3f(x1 - 3, y2 + 3, z1);
1332 OOGLEND();
1333 } else {
1334 OOGLBEGIN(GL_QUADS);
1335 glVertex3f(x1 - 3, y2, z1);
1336 glVertex3f(x1 + 2, y2, z1);
1337 glVertex3f(x1 + 2, y2 + 3, z1);
1338 glVertex3f(x1 - 3, y2 + 3, z1);
1339 OOGLEND();
1340 }
1341 OOGLBEGIN(GL_QUADS); // lollipop tail
1342 col[3] *= 0.3333; // one third the alpha
1343 glColor4fv(col);
1344 glVertex3f(x1, y1, z1);
1345 glVertex3f(x1 + 2, y1, z1);
1346 glVertex3f(x1 + 2, y2, z1);
1347 glVertex3f(x1, y2, z1);
1348 OOGLEND();
1349 }
1350 }
1351 }
1352 }
1353
1354 for (i = 0; i < ent_count; i++) {
1355 [my_entities[i] release]; // released
1356 }
1357
1359}
#define SCANNER_MAX_RANGE
Definition Entity.h:53
#define SCANNER_WIDTH
#define SCANNER_CENTRE_Y
#define SCANNER_CENTRE_X
#define SCANNER_SCALE
#define SCANNER_HEIGHT
static void DrawSpecialOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step, GLfloat *color4v)
static GLfloat nonlinearScannerFunc(GLfloat distance, GLfloat zoom, GLfloat scale)
static void GLDrawNonlinearCascadeWeapon(GLfloat x, GLfloat y, GLfloat z, NSSize siz, Vector centre, GLfloat radius, GLfloat zoom, GLfloat alpha)
static const GLfloat blue_color[4]
OOINLINE Vector vector_add(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:195
OOINLINE void scale_vector(Vector *outVector, OOScalar factor) ALWAYS_INLINE_FUNC NONNULL_FUNC
Definition OOVector.h:166
Vector OOVectorRandomRadial(OOScalar maxLength)
Definition OOVector.m:102
@ OO_POSTFX_NONE
Definition Universe.h:83
GLfloat collision_radius
Definition Entity.h:107
OOUniversalID universalID
Definition Entity.m:522
GLfloat zero_distance
Definition Entity.h:104
OOScanClass scanClass
Definition Entity.m:743
Vector nonlinearScannerScale:Zoom:Scale:(Vector V,[Zoom] GLfloat zoom,[Scale] double scale)
GLfloat scanner_zoom
static void drawScannerGrid(GLfloat x, GLfloat y, GLfloat z, NSSize siz, int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
BOOL minimalistic_scanner
GLfloat * scannerDisplayColorForShip:scannerDisplayColor1:scannerDisplayColor2:(BOOL flash,[scannerDisplayColor1] OOColor *scannerDisplayColor1,[scannerDisplayColor2] OOColor *scannerDisplayColor2)
Vector v_forward
Definition ShipEntity.h:189
GLfloat * scannerDisplayColorForShip:isHostile:flash:scannerDisplayColor1:scannerDisplayColor2:scannerDisplayColorH1:scannerDisplayColorH2:(ShipEntity *otherShip,[isHostile] BOOL isHostile,[flash] BOOL flash,[scannerDisplayColor1] OOColor *scannerDisplayColor1,[scannerDisplayColor2] OOColor *scannerDisplayColor2,[scannerDisplayColorH1] OOColor *scannerDisplayColorH1,[scannerDisplayColorH2] OOColor *scannerDisplayColorH2)
OOColor * scannerDisplayColor2()
BoundingBox totalBoundingBox
Vector v_up
Definition ShipEntity.h:189
OOColor * scannerDisplayColorHostile2()
OOColor * scannerDisplayColorHostile1()
BOOL hasHostileTarget()
double messageTime
OOColor * scannerDisplayColor1()
Vector v_right
Definition ShipEntity.h:189

References blue_color, HeadUpDisplay(Private)::checkPlayerInFlight, Entity::collision_radius, drawScannerGrid(), DrawSpecialOval(), EXPECT_NOT, GetRGBAArrayFromInfo(), GLDrawFilledOval(), GLDrawNonlinearCascadeWeapon(), GLDrawOval(), ShipEntity::hasHostileTarget, CachedInfo::height, int(), make_vector(), BoundingBox::max, ShipEntity::messageTime, BoundingBox::min, nil, nonlinearScannerFunc(), nonlinearScannerScale:Zoom:Scale:, OO_POSTFX_NONE, OODrawString(), OOGL, OOGLBEGIN, OOGLEND, OOVectorMultiplyMatrix(), OOVectorRandomRadial(), OOVerifyOpenGLState, PLAYER, ShipEntity::primaryTarget, scale_vector(), Entity::scanClass, SCANNER_CENTRE_X, SCANNER_CENTRE_Y, SCANNER_HEIGHT, SCANNER_MAX_RANGE, SCANNER_SCALE, SCANNER_WIDTH, OOVisualEffectEntity::scannerDisplayColor1, ShipEntity::scannerDisplayColor1, OOVisualEffectEntity::scannerDisplayColor2, ShipEntity::scannerDisplayColor2, ShipEntity::scannerDisplayColorForShip:isHostile:flash:scannerDisplayColor1:scannerDisplayColor2:scannerDisplayColorH1:scannerDisplayColorH2:, OOVisualEffectEntity::scannerDisplayColorForShip:scannerDisplayColor1:scannerDisplayColor2:, ShipEntity::scannerDisplayColorHostile1, ShipEntity::scannerDisplayColorHostile2, ShipEntity::totalBoundingBox, Entity::universalID, UNIVERSE, useDefined(), ShipEntity::v_forward, ShipEntity::v_right, ShipEntity::v_up, vector_add(), CachedInfo::width, CachedInfo::x, Vector::x, x, CachedInfo::x0, CachedInfo::y, Vector::y, y, CachedInfo::y0, Vector::z, and Entity::zero_distance.

Here is the call graph for this function:

◆ drawScannerGrid

+ (void) drawScannerGrid (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(int) v_dir
(GLfloat) thickness
(GLfloat) zoom
(BOOL) nonlinear
(BOOL) minimalistic 
implementation

Definition at line 3914 of file HeadUpDisplay.m.

3915{
3917
3918 MyOpenGLView* gameView = [UNIVERSE gameView];
3919
3920 GLfloat w1, h1;
3921 GLfloat ww = 0.5 * siz.width;
3922 GLfloat hh = 0.5 * siz.height;
3923
3924 GLfloat km_scan;
3925 GLfloat hdiv;
3926 GLfloat wdiv;
3927 BOOL drawdiv = NO, drawdiv1 = NO, drawdiv5 = NO;
3928
3929 int i, ii;
3930
3931 OOGL(GLScaledLineWidth(2.0 * thickness));
3932 GLDrawOval(x, y, z, siz, 4);
3933 OOGL(GLScaledLineWidth(thickness)); // reset (thickness = lineWidth)
3934
3935 OOGLBEGIN(GL_LINES);
3936 if (!minimalistic) {
3937 glVertex3f(x, y - hh, z);
3938 glVertex3f(x, y + hh, z);
3939 glVertex3f(x - ww, y, z);
3940 glVertex3f(x + ww, y, z);
3941
3942 if (nonlinear) {
3943 if (nonlinearScannerFunc(4000.0, zoom, hh) - nonlinearScannerFunc(3000.0, zoom, hh) > 2)
3944 drawdiv1 = YES;
3945 if (nonlinearScannerFunc(10000.0, zoom, hh) - nonlinearScannerFunc(5000.0, zoom, hh) > 2)
3946 drawdiv5 = YES;
3947 wdiv = ww / (0.001 * SCANNER_MAX_RANGE);
3948 for (i = 1; 1000.0 * i < SCANNER_MAX_RANGE; i++) {
3949 drawdiv = drawdiv1;
3950 w1 = wdiv;
3951 if (i % 10 == 0) {
3952 w1 = wdiv * 4;
3953 drawdiv = YES;
3954 if (nonlinearScannerFunc((i + 5) * 1000, zoom, hh) - nonlinearScannerFunc(i * 1000.0, zoom, hh) > 2) {
3955 drawdiv5 = YES;
3956 } else {
3957 drawdiv5 = NO;
3958 }
3959 } else if (i % 5 == 0) {
3960 w1 = wdiv * 2;
3961 drawdiv = drawdiv5;
3962 if (nonlinearScannerFunc((i + 1) * 1000, zoom, hh) - nonlinearScannerFunc(i * 1000.0, zoom, hh) > 2) {
3963 drawdiv1 = YES;
3964 } else {
3965 drawdiv1 = NO;
3966 }
3967 }
3968 if (drawdiv) {
3969 h1 = nonlinearScannerFunc(i * 1000.0, zoom, hh);
3970 glVertex3f(x - w1, y + h1, z);
3971 glVertex3f(x + w1, y + h1, z);
3972 glVertex3f(x - w1, y - h1, z);
3973 glVertex3f(x + w1, y - h1, z);
3974 }
3975 }
3976 } else {
3977 km_scan = 0.001 * SCANNER_MAX_RANGE / zoom; // calculate kilometer divisions
3978 hdiv = 0.5 * siz.height / km_scan;
3979 wdiv = 0.25 * siz.width / km_scan;
3980 if (wdiv < 4.0) {
3981 wdiv *= 2.0;
3982 ii = 5;
3983 } else {
3984 ii = 1;
3985 }
3986
3987 for (i = ii; 2.0 * hdiv * i < siz.height; i += ii) {
3988 h1 = i * hdiv;
3989 w1 = wdiv;
3990 if (i % 5 == 0)
3991 w1 = w1 * 2.5;
3992 if (i % 10 == 0)
3993 w1 = w1 * 2.0;
3994 if (w1 > 3.5) // don't draw tiny marks
3995 {
3996 glVertex3f(x - w1, y + h1, z);
3997 glVertex3f(x + w1, y + h1, z);
3998 glVertex3f(x - w1, y - h1, z);
3999 glVertex3f(x + w1, y - h1, z);
4000 }
4001 }
4002 }
4003 }
4004
4005 double tanfov = [gameView fov:YES];
4006 GLfloat aspect = [gameView viewSize].width / [gameView viewSize].height;
4007 if (aspect < 4.0 / 3.0) {
4008 tanfov *= 0.75 * aspect;
4009 }
4010 double cosfov = 1.0 / sqrt(1 + tanfov * tanfov);
4011 double sinfov = tanfov * cosfov;
4012
4013 switch (v_dir) {
4014 case VIEW_BREAK_PATTERN:
4015 case VIEW_GUI_DISPLAY:
4016 case VIEW_FORWARD:
4017 case VIEW_NONE:
4018 glVertex3f(x, y, z);
4019 glVertex3f(x - ww * sinfov, y + hh * cosfov, z);
4020 glVertex3f(x, y, z);
4021 glVertex3f(x + ww * sinfov, y + hh * cosfov, z);
4022 break;
4023
4024 case VIEW_AFT:
4025 glVertex3f(x, y, z);
4026 glVertex3f(x - ww * sinfov, y - hh * cosfov, z);
4027 glVertex3f(x, y, z);
4028 glVertex3f(x + ww * sinfov, y - hh * cosfov, z);
4029 break;
4030
4031 case VIEW_PORT:
4032 glVertex3f(x, y, z);
4033 glVertex3f(x - ww * cosfov, y + hh * sinfov, z);
4034 glVertex3f(x, y, z);
4035 glVertex3f(x - ww * cosfov, y - hh * sinfov, z);
4036 break;
4037
4038 case VIEW_STARBOARD:
4039 glVertex3f(x, y, z);
4040 glVertex3f(x + ww * cosfov, y + hh * sinfov, z);
4041 glVertex3f(x, y, z);
4042 glVertex3f(x + ww * cosfov, y - hh * sinfov, z);
4043 break;
4044 }
4045 OOGLEND();
4046
4048}
@ OPENGL_STATE_OVERLAY
Definition OOOpenGL.h:124
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
static GLfloat nonlinearScannerFunc(GLfloat distance, GLfloat zoom, GLfloat scale)
float fov:(BOOL inFraction)

References MyOpenGLView::fov:, GLDrawOval(), GLScaledLineWidth(), nonlinearScannerFunc(), OOGL, OOGLBEGIN, OOGLEND, OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_OVERLAY, SCANNER_MAX_RANGE, MyOpenGLView::viewSize, x, and y.

Here is the call graph for this function:

◆ drawScannerZoomIndicator:

- (void) drawScannerZoomIndicator: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1408 of file HeadUpDisplay.m.

1408 :(NSDictionary*)info
1409{
1410 int x, y;
1411 NSSize siz;
1412 GLfloat alpha;
1413 GLfloat zoom_color[4] = { 1.0f, 0.1f, 0.0f, 1.0f };
1414 struct CachedInfo cached;
1415
1416 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1417
1418 x = useDefined(cached.x, ZOOM_INDICATOR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1419 y = useDefined(cached.y, ZOOM_INDICATOR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1421 siz.height = useDefined(cached.height, ZOOM_INDICATOR_HEIGHT);
1422
1423 GetRGBAArrayFromInfo(info, zoom_color);
1424 zoom_color[3] *= overallAlpha;
1425 alpha = zoom_color[3];
1426
1427 GLfloat cx = x - 0.3 * siz.width;
1428 GLfloat cy = y - 0.75 * siz.height;
1429
1430 int zl = scanner_zoom;
1431 if (zl < 1)
1432 zl = 1;
1433 if (zl > SCANNER_ZOOM_LEVELS)
1435 if (zl == 1)
1436 zoom_color[3] *= 0.75;
1438 zl = pow(2, zl - 1);
1439 GLColorWithOverallAlpha(zoom_color, alpha);
1440 OOGL(glEnable(GL_TEXTURE_2D));
1442
1443 OOGLBEGIN(GL_QUADS);
1444 if (zl / 10 > 0)
1445 drawCharacterQuad(48 + zl / 10, cx - 0.8 * siz.width, cy, z1, siz);
1446 drawCharacterQuad(48 + zl % 10, cx - 0.4 * siz.width, cy, z1, siz);
1447 drawCharacterQuad(58, cx, cy, z1, siz);
1448 drawCharacterQuad(49, cx + 0.3 * siz.width, cy, z1, siz);
1449 OOGLEND();
1450
1452 OOGL(glDisable(GL_TEXTURE_2D));
1453}
#define ZOOM_INDICATOR_HEIGHT
#define ZOOM_INDICATOR_WIDTH
#define SCANNER_ZOOM_LEVELS
#define ZOOM_INDICATOR_CENTRE_X
#define ZOOM_INDICATOR_CENTRE_Y
static GLfloat drawCharacterQuad(uint8_t chr, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
void apply()
Definition OOTexture.m:258
void applyNone()
Definition OOTexture.m:263

References OOTexture::apply, OOTexture::applyNone, GetRGBAArrayFromInfo(), CachedInfo::height, OOGL, OOGLBEGIN, OOGLEND, SCANNER_ZOOM_LEVELS, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, ZOOM_INDICATOR_CENTRE_X, ZOOM_INDICATOR_CENTRE_Y, ZOOM_INDICATOR_HEIGHT, and ZOOM_INDICATOR_WIDTH.

Here is the call graph for this function:

◆ drawScoopStatus:

- (void) drawScoopStatus: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2860 of file HeadUpDisplay.m.

2860 :(NSDictionary*)info
2861{
2862 int i, x, y;
2863 NSSize siz;
2864 GLfloat alpha;
2865 struct CachedInfo cached;
2866
2867 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2868
2869 x = useDefined(cached.x, SCOOPSTATUS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2870 y = useDefined(cached.y, SCOOPSTATUS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2871 siz.width = useDefined(cached.width, SCOOPSTATUS_WIDTH);
2872 siz.height = useDefined(cached.height, SCOOPSTATUS_HEIGHT);
2873 // default alpha value different from all others, won't use cached.alpha
2874 alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:0.75f];
2875
2876 const GLfloat* s0_color = red_color;
2877 GLfloat s1c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
2878 GLfloat s2c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
2879 GLfloat s3c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
2880 int scoop_status = [PLAYER dialFuelScoopStatus];
2881 GLfloat t = [UNIVERSE getTime];
2882 GLfloat a1 = alpha * 0.5f * (1.0f + sin(t * 8.0f));
2883 GLfloat a2 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 1.0f));
2884 GLfloat a3 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 2.0f));
2885
2886 switch (scoop_status) {
2888 return; // don't draw
2889
2891 s0_color = darkgreen_color;
2892 alpha *= 0.75;
2893 break;
2894
2896 case SCOOP_STATUS_OKAY:
2897 s0_color = green_color;
2898 break;
2899 }
2900
2901 for (i = 0; i < 3; i++) {
2902 s1c[i] = s0_color[i];
2903 s2c[i] = s0_color[i];
2904 s3c[i] = s0_color[i];
2905 }
2906 if (scoop_status == SCOOP_STATUS_FULL_HOLD) {
2907 s3c[0] = red_color[0];
2908 s3c[1] = red_color[1];
2909 s3c[2] = red_color[2];
2910 }
2911 if (scoop_status == SCOOP_STATUS_ACTIVE) {
2912 s1c[3] = alpha * a1;
2913 s2c[3] = alpha * a2;
2914 s3c[3] = alpha * a3;
2915 } else {
2916 s1c[3] = alpha;
2917 s2c[3] = alpha;
2918 s3c[3] = alpha;
2919 }
2920
2921 GLfloat w1 = siz.width / 8.0;
2922 GLfloat w2 = 2.0 * w1;
2923 // GLfloat w3 = 3.0 * w1;
2924 GLfloat w4 = 4.0 * w1;
2925 GLfloat h1 = siz.height / 8.0;
2926 GLfloat h2 = 2.0 * h1;
2927 GLfloat h3 = 3.0 * h1;
2928 GLfloat h4 = 4.0 * h1;
2929
2930 OOGL(glDisable(GL_TEXTURE_2D));
2931 OOGLBEGIN(GL_QUADS);
2932 // section 1
2934 glVertex3f(x, y + h1, z1);
2935 glVertex3f(x - w2, y + h2, z1);
2936 glVertex3f(x, y + h3, z1);
2937 glVertex3f(x + w2, y + h2, z1);
2938 // section 2
2940 glVertex3f(x, y - h1, z1);
2941 glVertex3f(x - w4, y + h1, z1);
2942 glVertex3f(x - w4, y + h2, z1);
2943 glVertex3f(x, y, z1);
2944 glVertex3f(x, y - h1, z1);
2945 glVertex3f(x + w4, y + h1, z1);
2946 glVertex3f(x + w4, y + h2, z1);
2947 glVertex3f(x, y, z1);
2948 // section 3
2950 glVertex3f(x, y - h4, z1);
2951 glVertex3f(x - w2, y - h2, z1);
2952 glVertex3f(x - w2, y - h1, z1);
2953 glVertex3f(x, y - h2, z1);
2954 glVertex3f(x, y - h4, z1);
2955 glVertex3f(x + w2, y - h2, z1);
2956 glVertex3f(x + w2, y - h1, z1);
2957 glVertex3f(x, y - h2, z1);
2958 OOGLEND();
2959}
#define SCOOPSTATUS_HEIGHT
#define SCOOPSTATUS_CENTRE_X
#define SCOOPSTATUS_WIDTH
#define SCOOPSTATUS_CENTRE_Y
static const GLfloat darkgreen_color[4]
@ SCOOP_STATUS_FULL_HOLD
@ SCOOP_STATUS_NOT_INSTALLED
@ SCOOP_STATUS_ACTIVE
@ SCOOP_STATUS_OKAY

References darkgreen_color, green_color, CachedInfo::height, OOGL, OOGLBEGIN, OOGLEND, red_color, SCOOP_STATUS_ACTIVE, SCOOP_STATUS_FULL_HOLD, SCOOP_STATUS_NOT_INSTALLED, SCOOP_STATUS_OKAY, SCOOPSTATUS_CENTRE_X, SCOOPSTATUS_CENTRE_Y, SCOOPSTATUS_HEIGHT, SCOOPSTATUS_WIDTH, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawSecondaryTargetReticle:

- (void) drawSecondaryTargetReticle: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2503 of file HeadUpDisplay.m.

2503 :(NSDictionary*)info
2504{
2505 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha * 0.4;
2506
2507 PlayerEntity* player = PLAYER;
2508 if ([player hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"]) {
2509 // needs target memory to be working in addition to any other equipment
2510 // this item may be bound to
2511 NSMutableArray* targetMemory = [player targetMemory];
2512 ShipEntity* primary = [player primaryTarget];
2513 for (unsigned i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++) {
2514 id sec_id = [targetMemory objectAtIndex:i];
2515 // isProxy = weakref ; not = NSNull (in this case...)
2516 // can't use isKindOfClass because that throws
2517 // NSInvalidArgumentException when called on a weakref
2518 // with a dropped object.
2519 // TODO: fix OOWeakReference so isKindOfClass works
2520 if (sec_id != nil && [sec_id isProxy]) {
2521 ShipEntity* secondary = [(OOWeakReference*)sec_id weakRefUnderlyingObject];
2522 if (secondary != nil && secondary != primary) {
2523 if ([secondary zeroDistance] <= SCANNER_MAX_RANGE2 && [secondary isInSpace]) {
2524 hudDrawReticleOnTarget(secondary, PLAYER, z1, alpha, NO, nil, YES, NO, info, _reticleColors);
2525 }
2526 }
2527 }
2528 }
2529 }
2530}
#define SCANNER_MAX_RANGE2
Definition Entity.h:54
#define PLAYER_TARGET_MEMORY_SIZE
static void hudDrawReticleOnTarget(Entity *target, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive, BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
NSMutableArray * targetMemory()

References hudDrawReticleOnTarget(), nil, PLAYER, PLAYER_TARGET_MEMORY_SIZE, ShipEntity::primaryTarget, SCANNER_MAX_RANGE2, PlayerEntity::targetMemory, and OOWeakReference::weakRefUnderlyingObject.

Referenced by HeadUpDisplay(Private)::drawTargetReticle:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawSpecialOval

+ (void) DrawSpecialOval (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(GLfloat) step
(GLfloat *) color4v 
implementation

Definition at line 4050 of file HeadUpDisplay.m.

4051{
4052 GLfloat ww = 0.5 * siz.width;
4053 GLfloat hh = 0.5 * siz.height;
4054 GLfloat theta;
4055 GLfloat delta;
4056 GLfloat s;
4057
4058 delta = step * M_PI / 180.0f;
4059
4060 OOGLBEGIN(GL_LINE_LOOP);
4061 for (theta = 0.0f; theta < (2.0f * M_PI); theta += delta) {
4062 s = sin(theta);
4063 glColor4f(color4v[0], color4v[1], color4v[2], fabs(s * color4v[3]));
4064 glVertex3f(x + ww * s, y + hh * cos(theta), z);
4065 }
4066 OOGLEND();
4067}
#define M_PI
Definition OOMaths.h:54

References M_PI, OOGLBEGIN, OOGLEND, x, and y.

◆ drawSpeedBar:

- (void) drawSpeedBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1859 of file HeadUpDisplay.m.

1859 :(NSDictionary*)info
1860{
1861 int x, y;
1862 NSSize siz;
1863 BOOL draw_surround;
1864 GLfloat alpha = overallAlpha;
1865 GLfloat ds = [PLAYER dialSpeed];
1866 struct CachedInfo cached;
1867
1868 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1869
1870 x = useDefined(cached.x, SPEED_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1871 y = useDefined(cached.y, SPEED_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1872 siz.width = useDefined(cached.width, SPEED_BAR_WIDTH);
1873 siz.height = useDefined(cached.height, SPEED_BAR_HEIGHT);
1874 alpha *= cached.alpha;
1875
1876 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:SPEED_BAR_DRAW_SURROUND];
1877
1879 if (draw_surround) {
1880 // draw speed surround
1881 hudDrawSurroundAt(x, y, z1, siz);
1882 }
1883 // draw speed bar
1884 if (ds > .80) {
1886 } else if (ds > .25) {
1888 } else {
1890 }
1891
1892 hudDrawBarAt(x, y, z1, siz, ds);
1893}
#define SPEED_BAR_CENTRE_Y
#define SPEED_BAR_WIDTH
#define SPEED_BAR_HEIGHT
#define SPEED_BAR_CENTRE_X

References CachedInfo::alpha, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, SPEED_BAR_CENTRE_X, SPEED_BAR_CENTRE_Y, SPEED_BAR_HEIGHT, SPEED_BAR_WIDTH, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawStatusLight:

- (void) drawStatusLight: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2545 of file HeadUpDisplay.m.

2545 :(NSDictionary*)info
2546{
2547 int x, y;
2548 NSSize siz;
2549 GLfloat alpha = overallAlpha;
2550 BOOL blueAlert = cloakIndicatorOnStatusLight && [PLAYER isCloaked];
2551 struct CachedInfo cached;
2552
2553 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2554
2555 x = useDefined(cached.x, STATUS_LIGHT_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2556 y = useDefined(cached.y, STATUS_LIGHT_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2558 siz.height = useDefined(cached.height, STATUS_LIGHT_HEIGHT);
2559 alpha *= cached.alpha;
2560
2561 GLfloat status_color[4] = { 0.25, 0.25, 0.25, 1.0 };
2562 int alertCondition = [PLAYER alertCondition];
2563 GLfloat flash_alpha = 0.333 * (2.0f + sin((GLfloat)[UNIVERSE getTime] * 2.5f * alertCondition));
2564
2565 switch (alertCondition) {
2567 status_color[0] = red_color[0];
2568 status_color[1] = red_color[1];
2569 status_color[2] = blueAlert ? blue_color[2] : red_color[2];
2570 break;
2571
2573 status_color[0] = green_color[0];
2574 status_color[1] = green_color[1];
2575 status_color[2] = blueAlert ? blue_color[2] : green_color[2];
2576 break;
2577
2579 status_color[0] = yellow_color[0];
2580 status_color[1] = yellow_color[1];
2581 status_color[2] = blueAlert ? blue_color[2] : yellow_color[2];
2582 break;
2583
2584 default:
2586 break;
2587 }
2588 status_color[3] = flash_alpha;
2589 GLColorWithOverallAlpha(status_color, alpha);
2590 OOGLBEGIN(GL_POLYGON);
2591 hudDrawStatusIconAt(x, y, z1, siz);
2592 OOGLEND();
2593 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
2594 OOGLBEGIN(GL_LINE_LOOP);
2595 hudDrawStatusIconAt(x, y, z1, siz);
2596 OOGLEND();
2597}
#define STATUS_LIGHT_CENTRE_X
#define STATUS_LIGHT_CENTRE_Y
#define STATUS_LIGHT_HEIGHT
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:170
@ ALERT_CONDITION_RED
Definition ShipEntity.h:172
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:171
@ ALERT_CONDITION_DOCKED
Definition ShipEntity.h:169
BOOL cloakIndicatorOnStatusLight

References ALERT_CONDITION_DOCKED, ALERT_CONDITION_GREEN, ALERT_CONDITION_RED, ALERT_CONDITION_YELLOW, CachedInfo::alpha, blue_color, green_color, CachedInfo::height, hudDrawStatusIconAt(), OOGL, OOGLBEGIN, OOGLEND, red_color, STATUS_LIGHT_CENTRE_X, STATUS_LIGHT_CENTRE_Y, STATUS_LIGHT_HEIGHT, UNIVERSE, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawStickSensitivityIndicator:

- (void) drawStickSensitivityIndicator: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2961 of file HeadUpDisplay.m.

2961 :(NSDictionary*)info
2962{
2963 GLfloat x, y;
2964 NSSize siz;
2965 GLfloat alpha = overallAlpha;
2966 BOOL mouse = [PLAYER isMouseControlOn];
2967 OOJoystickManager* stickHandler = [OOJoystickManager sharedStickHandler];
2968 struct CachedInfo cached;
2969
2970 if (![stickHandler joystickCount]) {
2971 return; // no need to draw if no joystick fitted
2972 }
2973
2974 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2975
2976 x = useDefined(cached.x, STATUS_LIGHT_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2977 y = useDefined(cached.y, STATUS_LIGHT_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2978 siz.width = useDefined(cached.width, STATUS_LIGHT_HEIGHT);
2979 siz.height = useDefined(cached.height, STATUS_LIGHT_HEIGHT);
2980 alpha *= cached.alpha;
2981
2982 GLfloat div = [stickHandler getSensitivity];
2983
2985 GLDrawFilledOval(x, y, z1, siz, 10);
2986
2987 GLColorWithOverallAlpha((div < 1.0 || mouse) ? lightgray_color : green_color, alpha);
2989
2990 if (div >= 1.0) {
2991 if (!mouse) {
2992 NSSize siz8th = { siz.width / 8, siz.height / 8 };
2993 GLDrawFilledOval(x, y, z1, siz8th, 30);
2994
2995 if (div == 1.0) // normal mode
2997 }
2998
2999 siz.width -= _crosshairWidth * lineWidth / 2;
3000 siz.height -= _crosshairWidth * lineWidth / 2;
3001 GLDrawOval(x, y, z1, siz, 10);
3002 } else if (div < 1.0) // insensitive mode (shouldn't happen)
3003 GLDrawFilledOval(x, y, z1, siz, 10);
3004
3005 OOGL(GLScaledLineWidth(lineWidth)); // reset
3006}
GLfloat _crosshairWidth

References CachedInfo::alpha, black_color, OOJoystickManager::getSensitivity, GLDrawFilledOval(), GLDrawOval(), GLScaledLineWidth(), green_color, CachedInfo::height, lightgray_color, OOGL, OOJoystickManager::sharedStickHandler, STATUS_LIGHT_CENTRE_X, STATUS_LIGHT_CENTRE_Y, STATUS_LIGHT_HEIGHT, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawSurround:

- (void) drawSurround: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3032 of file HeadUpDisplay.m.

3032 :(NSDictionary*)info
3033{
3034 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
3035 id colorDesc = [info objectForKey:COLOR_KEY];
3036 if (colorDesc != nil) {
3037 OOColor* color = [OOColor colorWithDescription:colorDesc];
3038 if (color != nil) {
3039 itemColor[0] = [color redComponent];
3040 itemColor[1] = [color greenComponent];
3041 itemColor[2] = [color blueComponent];
3042 }
3043 }
3044
3045 [self drawSurroundInternal:info color:itemColor];
3046}

References OOColor::blueComponent, OOColor::colorWithDescription:, drawSurroundInternal:color:, OOColor::greenComponent, nil, and OOColor::redComponent.

Here is the call graph for this function:

◆ drawSurroundInternal:color:

- (void) drawSurroundInternal: (NSDictionary*) info
color: (const GLfloat[4]) color 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3008 of file HeadUpDisplay.m.

3008 :(NSDictionary*)info color:(const GLfloat[4])color
3009{
3010 NSInteger x, y;
3011 NSSize siz;
3012 GLfloat alpha = overallAlpha;
3013 struct CachedInfo cached;
3014
3015 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3016
3017 if (cached.x == NOT_DEFINED || cached.y == NOT_DEFINED || cached.width == NOT_DEFINED || cached.height == NOT_DEFINED) {
3018 return;
3019 }
3020
3021 x = cached.x + [[UNIVERSE gameView] x_offset] * cached.x0;
3022 y = cached.y + [[UNIVERSE gameView] y_offset] * cached.y0;
3023 siz.width = useDefined(cached.width, WEAPONSOFFLINETEXT_WIDTH);
3024 siz.height = useDefined(cached.height, WEAPONSOFFLINETEXT_HEIGHT);
3025 alpha *= cached.alpha;
3026
3027 // draw the surround
3028 GLColorWithOverallAlpha(color, alpha);
3029 hudDrawSurroundAt(x, y, z1, siz);
3030}
#define WEAPONSOFFLINETEXT_WIDTH
#define WEAPONSOFFLINETEXT_HEIGHT
#define NOT_DEFINED

References CachedInfo::alpha, CachedInfo::height, hudDrawSurroundAt(), NOT_DEFINED, useDefined(), WEAPONSOFFLINETEXT_HEIGHT, WEAPONSOFFLINETEXT_WIDTH, CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Referenced by HeadUpDisplay(Private)::drawGreenSurround:, HeadUpDisplay(Private)::drawMultiFunctionDisplay:withText:asIndex:, HeadUpDisplay(Private)::drawSurround:, and HeadUpDisplay(Private)::drawYellowSurround:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawTargetReticle:

- (void) drawTargetReticle: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2489 of file HeadUpDisplay.m.

2489 :(NSDictionary*)info
2490{
2491 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2492
2493 if ([PLAYER primaryTarget] != nil) {
2495 [self drawDirectionCue:info];
2496 }
2497 // extra feature if extra equipment installed
2498 if ([PLAYER hasEquipmentItemProviding:@"EQ_INTEGRATED_TARGETING_SYSTEM"]) {
2499 [self drawSecondaryTargetReticle:info];
2500 }
2501}
BOOL reticleTargetSensitive

References drawDirectionCue:, drawSecondaryTargetReticle:, hudDrawReticleOnTarget(), nil, and PLAYER.

Here is the call graph for this function:

◆ drawTrumbles:

- (void) drawTrumbles: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3058 of file HeadUpDisplay.m.

3058 :(NSDictionary*)info
3059{
3060 OOTrumble** trumbles = [PLAYER trumbleArray];
3061 NSUInteger i;
3062 for (i = [PLAYER trumbleCount]; i > 0; i--) {
3063 OOTrumble* trum = trumbles[i - 1];
3064 [trum drawTrumble:z1];
3065 }
3066}
void drawTrumble:(double z)
Definition OOTrumble.m:362

References OOTrumble::drawTrumble:, and PLAYER.

Here is the call graph for this function:

◆ drawWaypoints:

- (void) drawWaypoints: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2532 of file HeadUpDisplay.m.

2532 :(NSDictionary*)info
2533{
2534 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2535 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
2536
2537 OOWaypointEntity* waypoint = nil;
2538 Entity* compass = [PLAYER compassTarget];
2539
2540 foreach (waypoint, [[UNIVERSE currentWaypoints] allValues]) {
2541 hudDrawWaypoint(waypoint, PLAYER, z1, alpha, waypoint == compass, scale);
2542 }
2543}
static void hudDrawWaypoint(OOWaypointEntity *waypoint, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL selected, GLfloat scale)

References hudDrawWaypoint(), nil, PLAYER, and UNIVERSE.

Here is the call graph for this function:

◆ drawWeaponsOfflineText:

- (void) drawWeaponsOfflineText: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2789 of file HeadUpDisplay.m.

2789 :(NSDictionary*)info
2790{
2791 OOViewID viewID = [UNIVERSE viewDirection];
2792 GLfloat textColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2793
2794 if (viewID == VIEW_CUSTOM || overallAlpha == 0.0f || !([PLAYER status] == STATUS_IN_FLIGHT || [PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
2795 [UNIVERSE displayGUI]) {
2796 // Don't draw weapons offline text
2797 return;
2798 }
2799
2800 if (![PLAYER weaponsOnline]) {
2801 int x, y;
2802 NSSize siz;
2803 struct CachedInfo cached;
2804
2805 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2806
2807 x = useDefined(cached.x, WEAPONSOFFLINETEXT_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2808 y = useDefined(cached.y, WEAPONSOFFLINETEXT_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2810 siz.height = useDefined(cached.height, WEAPONSOFFLINETEXT_HEIGHT);
2811
2812 GetRGBAArrayFromInfo(info, textColor);
2813 textColor[3] *= overallAlpha;
2814
2815 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], textColor[3]));
2816 // TODO: some caching required...
2817 OODrawString(DESC(@"weapons-systems-offline"), x, y, z1, siz);
2818 }
2819}
#define WEAPONSOFFLINETEXT_DISPLAY_X
#define WEAPONSOFFLINETEXT_DISPLAY_Y
#define DESC(key)
Definition Universe.h:832

References DESC, GetRGBAArrayFromInfo(), CachedInfo::height, OODrawString(), OOGL, PLAYER, UNIVERSE, useDefined(), WEAPONSOFFLINETEXT_DISPLAY_X, WEAPONSOFFLINETEXT_DISPLAY_Y, WEAPONSOFFLINETEXT_HEIGHT, WEAPONSOFFLINETEXT_WIDTH, CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawWeaponTempBar:

- (void) drawWeaponTempBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2232 of file HeadUpDisplay.m.

2232 :(NSDictionary*)info
2233{
2234 int x, y;
2235 NSSize siz;
2236 BOOL draw_surround;
2237 GLfloat temp = [PLAYER laserHeatLevel];
2238 GLfloat alpha = overallAlpha;
2239 struct CachedInfo cached;
2240
2241 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2242
2243 x = useDefined(cached.x, WEAPON_TEMP_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2244 y = useDefined(cached.y, WEAPON_TEMP_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2246 siz.height = useDefined(cached.height, WEAPON_TEMP_BAR_HEIGHT);
2247 alpha *= cached.alpha;
2248 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2249
2250 if (draw_surround) {
2252 hudDrawSurroundAt(x, y, z1, siz);
2253 }
2254
2255 // draw weapon_temp bar (only need to call GLColor() once!)
2256 if (temp > .80)
2258 else if (temp > .25)
2260 else
2262 hudDrawBarAt(x, y, z1, siz, temp);
2263}
#define WEAPON_TEMP_BAR_HEIGHT
#define WEAPON_TEMP_BAR_WIDTH
#define WEAPON_TEMP_BAR_CENTRE_X
#define WEAPON_TEMP_BAR_CENTRE_Y

References CachedInfo::alpha, green_color, CachedInfo::height, hudDrawBarAt(), hudDrawSurroundAt(), red_color, SET_COLOR_HIGH, SET_COLOR_LOW, SET_COLOR_MEDIUM, SET_COLOR_SURROUND, useDefined(), WEAPON_TEMP_BAR_CENTRE_X, WEAPON_TEMP_BAR_CENTRE_Y, WEAPON_TEMP_BAR_HEIGHT, WEAPON_TEMP_BAR_WIDTH, CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawWitchspaceDestination:

- (void) drawWitchspaceDestination: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 2157 of file HeadUpDisplay.m.

2157 :(NSDictionary*)info
2158{
2159 // A zero-distance jump counts as 0.1LY
2160 if ([PLAYER dialHyperRange] == 0.0f) {
2161 return;
2162 }
2163
2164 int x, y;
2165 NSSize siz;
2166 GLfloat alpha = overallAlpha;
2167
2168 struct CachedInfo cached;
2169
2170 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2171
2172 x = useDefined(cached.x, WITCHDEST_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2173 y = useDefined(cached.y, WITCHDEST_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2174 siz.width = useDefined(cached.width, WITCHDEST_WIDTH);
2175 siz.height = useDefined(cached.height, WITCHDEST_HEIGHT);
2176 alpha *= cached.alpha;
2177 NSString* dest = [UNIVERSE getSystemName:[PLAYER targetSystemID]];
2178 NSInteger concealment = [[[UNIVERSE systemManager] getPropertiesForSystem:[PLAYER targetSystemID] inGalaxy:[PLAYER galaxyNumber]] oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
2179 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME)
2180 dest = DESC(@"status-unknown-system");
2181
2183
2184 if ([info oo_intForKey:@"align"] == 1) {
2185 OODrawStringAligned(dest, x, y, z1, siz, YES);
2186 } else {
2187 OODrawStringAligned(dest, x, y, z1, siz, NO);
2188 }
2189}
#define WITCHDEST_WIDTH
#define WITCHDEST_HEIGHT
#define WITCHDEST_CENTRE_X
#define WITCHDEST_CENTRE_Y
@ OO_SYSTEMCONCEALMENT_NONAME

References CachedInfo::alpha, DESC, green_color, CachedInfo::height, OO_SYSTEMCONCEALMENT_NONAME, OODrawStringAligned(), PLAYER, SET_COLOR, useDefined(), CachedInfo::width, WITCHDEST_CENTRE_X, WITCHDEST_CENTRE_Y, WITCHDEST_HEIGHT, WITCHDEST_WIDTH, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, and CachedInfo::y0.

Here is the call graph for this function:

◆ drawYawBar:

- (void) drawYawBar: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 1949 of file HeadUpDisplay.m.

1949 :(NSDictionary*)info
1950{
1951 int x, y;
1952 NSSize siz;
1953 BOOL draw_surround;
1954 GLfloat alpha = overallAlpha;
1955 struct CachedInfo cached;
1956
1957 [(NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1958
1959 // No standard YAW definitions - using PITCH ones instead.
1960 x = useDefined(cached.x, PITCH_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1961 y = useDefined(cached.y, PITCH_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1962 siz.width = useDefined(cached.width, PITCH_BAR_WIDTH);
1963 siz.height = useDefined(cached.height, PITCH_BAR_HEIGHT);
1964 alpha *= cached.alpha;
1965 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
1966
1967 if (draw_surround) {
1968 // draw YAW surround
1970 hudDrawSurroundAt(x, y, z1, siz);
1971 }
1972 // draw YAW bar
1974 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialYaw]);
1975}

References CachedInfo::alpha, green_color, CachedInfo::height, hudDrawIndicatorAt(), hudDrawSurroundAt(), PITCH_BAR_CENTRE_X, PITCH_BAR_CENTRE_Y, PITCH_BAR_HEIGHT, PITCH_BAR_WIDTH, PLAYER, SET_COLOR, SET_COLOR_SURROUND, useDefined(), CachedInfo::width, CachedInfo::x, x, CachedInfo::x0, CachedInfo::y, y, CachedInfo::y0, and yellow_color.

Here is the call graph for this function:

◆ drawYellowSurround:

- (void) drawYellowSurround: (NSDictionary*) info
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 3053 of file HeadUpDisplay.m.

3053 :(NSDictionary*)info
3054{
3055 [self drawSurroundInternal:info color:yellow_color];
3056}

References drawSurroundInternal:color:.

Here is the call graph for this function:

◆ GLColorWithOverallAlpha

- (OOINLINE void) GLColorWithOverallAlpha (const GLfloat *) color
(GLfloat) alpha 
implementation

Definition at line 204 of file HeadUpDisplay.m.

205{
206 // NO OOGL(), this is called within immediate mode blocks.
207 glColor4f(color[0], color[1], color[2], color[3] * alpha);
208}

References OOINLINE.

Referenced by drawIconForEmptyPylonAtX:y:width:height:alpha:, drawIconForMissile:selected:status:x:y:width:height:alpha:, hudDrawReticleOnTarget, and hudDrawWaypoint.

Here is the caller graph for this function:

◆ GLDrawNonlinearCascadeWeapon

+ (void) GLDrawNonlinearCascadeWeapon (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(Vector) centre
(GLfloat) radius
(GLfloat) zoom
(GLfloat) alpha 
implementation

Definition at line 3834 of file HeadUpDisplay.m.

3835{
3836 Vector spacepos, scannerpos;
3837 GLfloat theta, phi;
3838 GLfloat z_factor = siz.height / siz.width; // approx 1/4
3839 GLfloat y_factor = 1.0 - sqrt(z_factor); // approx 1/2
3840 OOGLVector* points = malloc(sizeof(OOGLVector) * 25);
3841 int i, j;
3842
3843 if (radius * radius > centre.y * centre.y) {
3844 GLfloat r0 = sqrt(radius * radius - centre.y * centre.y);
3845 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
3846 spacepos.y = 0;
3847 for (i = 0; i < 24; i++) {
3848 theta = i * 2 * M_PI / 24;
3849 spacepos.x = centre.x + r0 * cos(theta);
3850 spacepos.z = centre.z + r0 * sin(theta);
3851 scannerpos = [HeadUpDisplay nonlinearScannerScale:spacepos Zoom:zoom Scale:0.5 * siz.width];
3852 points[i].x = x + scannerpos.x;
3853 points[i].y = y + scannerpos.z * z_factor + scannerpos.y * y_factor;
3854 points[i].z = z;
3855 }
3856 spacepos.x = centre.x + r0;
3857 spacepos.y = 0;
3858 spacepos.z = centre.z;
3859 scannerpos = [HeadUpDisplay nonlinearScannerScale:spacepos Zoom:zoom Scale:0.5 * siz.width];
3860 points[24].x = x + scannerpos.x;
3861 points[24].y = y + scannerpos.z * z_factor + scannerpos.y * y_factor;
3862 points[24].z = z;
3863 GLDrawPoints(points, 25);
3864 }
3865 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
3866 free(points);
3867 // Here, we draw a sphere distorted by the nonlinear function. We draw the sphere as a set of horizontal strips
3868 // The even indices of points are the points on the upper edge of the strip, while odd indices are points
3869 // on the bottom edge.
3870 points = malloc(sizeof(OOGLVector) * 50);
3871 spacepos.x = centre.x;
3872 spacepos.y = centre.y + radius;
3873 spacepos.z = centre.z;
3874 scannerpos = [HeadUpDisplay nonlinearScannerScale:spacepos Zoom:zoom Scale:0.5 * siz.width];
3875 for (i = 0; i <= 24; i++) {
3876 points[2 * i + 1].x = x + scannerpos.x;
3877 points[2 * i + 1].y = y + scannerpos.y * y_factor + scannerpos.z * z_factor;
3878 points[2 * i + 1].z = z;
3879 }
3880 for (i = 1; i <= 24; i++) {
3881 theta = i * M_PI / 24;
3882 for (j = 0; j <= 24; j++) {
3883 phi = j * M_PI / 12;
3884 // copy point from bottom edge of previous strip into top edge position
3885 points[2 * j] = points[2 * j + 1];
3886
3887 spacepos.x = centre.x + radius * sin(theta) * cos(phi);
3888 spacepos.y = centre.y + radius * cos(theta);
3889 spacepos.z = centre.z + radius * sin(theta) * sin(phi);
3890 scannerpos = [HeadUpDisplay nonlinearScannerScale:spacepos Zoom:zoom Scale:0.5 * siz.width];
3891 points[2 * j + 1].x = x + scannerpos.x;
3892 points[2 * j + 1].y = y + scannerpos.y * y_factor + scannerpos.z * z_factor;
3893 points[2 * j + 1].z = z;
3894 }
3895 GLDrawQuadStrip(points, 50);
3896 }
3897 free(points);
3898 return;
3899}
void GLDrawPoints(OOGLVector *points, int n)
Definition OOOpenGL.m:167
void GLDrawQuadStrip(OOGLVector *points, int n)
Definition OOOpenGL.m:193
GLfloat y
Definition OOOpenGL.h:199
GLfloat x
Definition OOOpenGL.h:198
GLfloat z
Definition OOOpenGL.h:200

References GLDrawPoints(), GLDrawQuadStrip(), M_PI, nonlinearScannerScale:Zoom:Scale:, OOGL, OOGLVector::x, Vector::x, x, OOGLVector::y, Vector::y, y, OOGLVector::z, and Vector::z.

Here is the call graph for this function:

◆ hasHidden:

- (BOOL) hasHidden: (NSString*) selectorName

Definition at line 588 of file HeadUpDisplay.m.

588 :(NSString*)selectorName
589{
590 if (selectorName == nil) {
591 return NO;
592 }
593 return [_hiddenSelectors containsObject:selectorName];
594}

References nil.

◆ hudDrawBarAt

+ (void) hudDrawBarAt (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(GLfloat) amount 
implementation

Definition at line 3181 of file HeadUpDisplay.m.

3182{
3183 GLfloat dial_ox = x - siz.width / 2;
3184 GLfloat dial_oy = y - siz.height / 2;
3185 if (fabs(siz.width) > fabs(siz.height)) {
3186 GLfloat position = dial_ox + amount * siz.width;
3187
3188 OOGLBEGIN(GL_QUADS);
3189 glVertex3f(dial_ox, dial_oy, z);
3190 glVertex3f(position, dial_oy, z);
3191 glVertex3f(position, dial_oy + siz.height, z);
3192 glVertex3f(dial_ox, dial_oy + siz.height, z);
3193 OOGLEND();
3194 } else {
3195 GLfloat position = dial_oy + amount * siz.height;
3196
3197 OOGLBEGIN(GL_QUADS);
3198 glVertex3f(dial_ox, dial_oy, z);
3199 glVertex3f(dial_ox, position, z);
3200 glVertex3f(dial_ox + siz.width, position, z);
3201 glVertex3f(dial_ox + siz.width, dial_oy, z);
3202 OOGLEND();
3203 }
3204}

References OOGLBEGIN, OOGLEND, x, and y.

◆ hudDrawIndicatorAt

+ (void) hudDrawIndicatorAt (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(GLfloat) amount 
implementation

Definition at line 3135 of file HeadUpDisplay.m.

3136{
3137 if (siz.width > siz.height) {
3138 GLfloat dial_oy = y - siz.height / 2;
3139 GLfloat position = x + amount * siz.width / 2;
3140 OOGLBEGIN(GL_QUADS);
3141 glVertex3f(position, dial_oy, z);
3142 glVertex3f(position + 2, y, z);
3143 glVertex3f(position, dial_oy + siz.height, z);
3144 glVertex3f(position - 2, y, z);
3145 OOGLEND();
3146 } else {
3147 GLfloat dial_ox = x - siz.width / 2;
3148 GLfloat position = y + amount * siz.height / 2;
3149 OOGLBEGIN(GL_QUADS);
3150 glVertex3f(dial_ox, position, z);
3151 glVertex3f(x, position + 2, z);
3152 glVertex3f(dial_ox + siz.width, position, z);
3153 glVertex3f(x, position - 2, z);
3154 OOGLEND();
3155 }
3156}

References OOGLBEGIN, OOGLEND, x, and y.

◆ hudDrawMarkerAt

+ (void) hudDrawMarkerAt (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(GLfloat) amount 
implementation

Definition at line 3158 of file HeadUpDisplay.m.

3159{
3160 if (siz.width > siz.height) {
3161 GLfloat dial_oy = y - siz.height / 2;
3162 GLfloat position = x + amount * siz.width - siz.width / 2;
3163 OOGLBEGIN(GL_QUADS);
3164 glVertex3f(position + 1, dial_oy + 1, z);
3165 glVertex3f(position + 1, dial_oy + siz.height - 1, z);
3166 glVertex3f(position - 1, dial_oy + siz.height - 1, z);
3167 glVertex3f(position - 1, dial_oy + 1, z);
3168 OOGLEND();
3169 } else {
3170 GLfloat dial_ox = x - siz.width / 2;
3171 GLfloat position = y + amount * siz.height - siz.height / 2;
3172 OOGLBEGIN(GL_QUADS);
3173 glVertex3f(dial_ox + 1, position + 1, z);
3174 glVertex3f(dial_ox + siz.width - 1, position + 1, z);
3175 glVertex3f(dial_ox + siz.width - 1, position - 1, z);
3176 glVertex3f(dial_ox + 1, position - 1, z);
3177 OOGLEND();
3178 }
3179}

References OOGLBEGIN, OOGLEND, x, and y.

◆ hudDrawReticleOnTarget

+ (void) hudDrawReticleOnTarget (Entity *) target
(PlayerEntity *) player1
(GLfloat) z1
(GLfloat) alpha
(BOOL) reticleTargetSensitive
(NSMutableDictionary *) propertiesReticleTargetSensitive
(BOOL) colourFromScannerColour
(BOOL) showText
(NSDictionary *) info
(NSMutableArray *) reticleColors 
implementation

Definition at line 3236 of file HeadUpDisplay.m.

3239{
3240 if (target == nil || player1 == nil) {
3241 return;
3242 }
3243 if ([player1 guiScreen] != GUI_SCREEN_MAIN) // don't draw on text screens
3244 {
3245 return;
3246 }
3247
3248 ShipEntity* target_ship = nil;
3249 NSString* legal_desc = nil;
3250
3251 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
3252
3253 if ([target isShip]) {
3254 target_ship = (ShipEntity*)target;
3255 legal_desc = [target_ship scanDescription];
3256 }
3257
3258 if ([target_ship isCloaked])
3259 return;
3260
3261 Vector p1;
3262
3263 // by definition close enough that single precision is fine
3264 p1 = HPVectorToVector(HPvector_subtract([target position], [player1 viewpointPosition]));
3265
3266 GLfloat rdist = magnitude(p1);
3267 GLfloat rsize = [target collisionRadius] / (2 * [[UNIVERSE gameView] fov:YES]); // FIXME integrate 2 into fov to remove magic number
3268
3269 if (rsize < rdist * scale)
3270 rsize = rdist * scale;
3271
3272 GLfloat rs0 = rsize;
3273 GLfloat rs2 = rsize * 0.50;
3274
3277
3278 // draw the reticle
3279 float range = sqrt(target->zero_distance) - target->collision_radius;
3280
3281 int flash = (int)([UNIVERSE getTime] * 4);
3282 flash &= 1;
3283
3284 // Draw reticle cyan for Wormholes
3285 if ([target isWormhole]) {
3286 OOColor* wormholeReticleColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_WORMHOLE];
3287 GLfloat wormholeReticleColorArray[4] = { [wormholeReticleColor redComponent],
3288 [wormholeReticleColor greenComponent],
3289 [wormholeReticleColor blueComponent],
3290 [wormholeReticleColor alphaComponent] };
3291 GLColorWithOverallAlpha(wormholeReticleColorArray, alpha);
3292 } else {
3293 // Reticle sensitivity accuracy calculation
3294 BOOL isTargeted = NO;
3295 GLfloat probabilityAccuracy;
3296
3298 // Only if target is within player's weapon range, we mind for reticle accuracy
3299 if (range < [player1 weaponRange]) {
3300 // After MAX_ACCURACY_RANGE km start decreasing high accuracy probability by ACCURACY_PROBABILITY_DECREASE_FACTOR%
3301 if (range > MAX_ACCURACY_RANGE) {
3302 // Every one second re-evaluate accuracy
3303 if ([UNIVERSE getTime] > [propertiesReticleTargetSensitive oo_doubleForKey:@"timeLastAccuracyProbabilityCalculation"] + 1) {
3304 probabilityAccuracy = 1 - (range - MAX_ACCURACY_RANGE) * ACCURACY_PROBABILITY_DECREASE_FACTOR;
3305 // Make sure probability does not go below a minimum
3306 probabilityAccuracy = probabilityAccuracy < MIN_PROBABILITY_ACCURACY ? MIN_PROBABILITY_ACCURACY : probabilityAccuracy;
3307 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithBool:((randf() < probabilityAccuracy) ? YES : NO)] forKey:@"isAccurate"];
3308
3309 // Store the time the last accuracy probability has been performed
3310 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithDouble:[UNIVERSE getTime]] forKey:@"timeLastAccuracyProbabilityCalculation"];
3311 }
3312 if ([propertiesReticleTargetSensitive oo_boolForKey:@"isAccurate"]) {
3313 // high accuracy reticle
3314 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3315 } else {
3316 // low accuracy reticle
3317 isTargeted = ([UNIVERSE firstEntityTargetedByPlayer] == target);
3318 }
3319 } else {
3320 // high accuracy reticle
3321 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3322 }
3323 }
3324 }
3325
3326 // If reticle is target sensitive, draw target box in red
3327 // when target passes through laser hit-point(with decreasing accuracy)
3328 // and is within hit-range.
3329 //
3330 // NOTE: The following condition also considers (indirectly) the player's weapon range.
3331 // 'isTargeted' is initialised to FALSE. Only if target is within the player's weapon range,
3332 // it might change value. Therefore, it is not necessary to add '&& range < [player1 weaponRange]'
3333 // to the following condition.
3334 if (colourFromScannerColour) {
3335 if ([target isShip]) {
3336 ShipEntity* ship = (ShipEntity*)target;
3337 BOOL isHostile = (([ship hasHostileTarget]) && ([ship primaryTarget] == PLAYER));
3338 GLColorWithOverallAlpha([ship scannerDisplayColorForShip:PLAYER isHostile:isHostile flash:flash scannerDisplayColor1:[ship scannerDisplayColor1] scannerDisplayColor2:[ship scannerDisplayColor2] scannerDisplayColorH1:[ship scannerDisplayColorHostile1] scannerDisplayColorH2:[ship scannerDisplayColorHostile2]], alpha);
3339 } else if ([target isVisualEffect]) {
3340 OOVisualEffectEntity* vis = (OOVisualEffectEntity*)target;
3341 GLColorWithOverallAlpha([vis scannerDisplayColorForShip:flash scannerDisplayColor1:[vis scannerDisplayColor1] scannerDisplayColor2:[vis scannerDisplayColor2]], alpha);
3342 } else {
3344 }
3345 } else {
3346 OOColor* reticleDisplayColor = nil;
3347 if (reticleTargetSensitive && isTargeted) {
3348 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET_SENSITIVE];
3349 if (!reticleDisplayColor)
3350 reticleDisplayColor = [OOColor redColor];
3351 } else {
3352 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET];
3353 if (!reticleDisplayColor)
3354 reticleDisplayColor = [OOColor greenColor];
3355 }
3356 GLfloat reticleDisplayColorArray[4] = { [reticleDisplayColor redComponent],
3357 [reticleDisplayColor greenComponent],
3358 [reticleDisplayColor blueComponent],
3359 [reticleDisplayColor alphaComponent] };
3360 GLColorWithOverallAlpha(reticleDisplayColorArray, alpha);
3361 }
3362 }
3363 OOGLBEGIN(GL_LINES);
3364 glVertex2f(rs0, rs2);
3365 glVertex2f(rs0, rs0);
3366 glVertex2f(rs0, rs0);
3367 glVertex2f(rs2, rs0);
3368
3369 glVertex2f(rs0, -rs2);
3370 glVertex2f(rs0, -rs0);
3371 glVertex2f(rs0, -rs0);
3372 glVertex2f(rs2, -rs0);
3373
3374 glVertex2f(-rs0, rs2);
3375 glVertex2f(-rs0, rs0);
3376 glVertex2f(-rs0, rs0);
3377 glVertex2f(-rs2, rs0);
3378
3379 glVertex2f(-rs0, -rs2);
3380 glVertex2f(-rs0, -rs0);
3381 glVertex2f(-rs0, -rs0);
3382 glVertex2f(-rs2, -rs0);
3383 OOGLEND();
3384
3385 if (showText) {
3386 // add text for reticle here
3387 range *= 0.001f;
3388 if (range < 0.001f)
3389 range = 0.0f; // avoids the occasional -0.001 km distance.
3390 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3391 float line_height = rdist * scale;
3392 NSString* infoline = [NSString stringWithFormat:@"%0.3f %@", range, distance_unit];
3393 if (legal_desc != nil)
3394 infoline = [NSString stringWithFormat:@"%@ (%@)", infoline, legal_desc];
3395 // no need to set colour here
3396 OODrawString([player1 dialTargetName], rs0, 0.5 * rs2, 0, textsize);
3397 OODrawString(infoline, rs0, 0.5 * rs2 - line_height, 0, textsize);
3398
3399 if ([target isWormhole]) {
3400 // Note: No break statements in the following switch() since every case
3401 // falls through to the next. Cases arranged in reverse order.
3402 switch ([(WormholeEntity*)target scanInfo]) {
3403 case WH_SCANINFO_SHIP:
3404 // TOOD: Render anything on the HUD for this?
3406 // Rendered above in dialTargetName, so no need to do anything here
3407 // unless we want a separate line Destination: XXX ?
3409 NSString* wormholeETA = [NSString stringWithFormat:DESC(@"wormhole-ETA-@"), ClockToString([(WormholeEntity*)target estimatedArrivalTime], NO)];
3410 OODrawString(wormholeETA, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
3411 }
3413 OOTimeDelta timeForCollapsing = [(WormholeEntity*)target expiryTime] - [player1 clockTimeAdjusted];
3414 int minutesToCollapse = floor(timeForCollapsing / 60.0);
3415 int secondsToCollapse = (int)timeForCollapsing % 60;
3416
3417 NSString* wormholeExpiringIn = [NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
3418 OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
3419 }
3421 case WH_SCANINFO_NONE:
3422 break;
3423 }
3424 }
3425 }
3426
3428}
#define ACCURACY_PROBABILITY_DECREASE_FACTOR
#define MIN_PROBABILITY_ACCURACY
#define MAX_ACCURACY_RANGE
OOINLINE HPVector HPvector_subtract(HPVector a, HPVector b) INLINE_CONST_FUNC
Definition OOHPVector.h:236
OOINLINE Vector HPVectorToVector(HPVector v) INLINE_CONST_FUNC
Definition OOHPVector.h:175
double OOTimeDelta
Definition OOTypes.h:193
OOINLINE OOScalar magnitude(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:242
@ WH_SCANINFO_NONE
@ WH_SCANINFO_SCANNED
@ WH_SCANINFO_SHIP
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
GLfloat collisionRadius()
Definition Entity.m:830
static void hudRotateViewpointForVirtualDepth(PlayerEntity *player1, Vector p1)
OOColor * redColor()
Definition OOColor.m:259
OOColor * greenColor()
Definition OOColor.m:264
NSString * scanDescription()
double estimatedArrivalTime()

References ACCURACY_PROBABILITY_DECREASE_FACTOR, OOColor::alphaComponent, OOColor::blueComponent, PlayerEntity::clockTimeAdjusted, Entity::collision_radius, Entity::collisionRadius, WormholeEntity::estimatedArrivalTime, WormholeEntity::expiryTime, GLColorWithOverallAlpha, green_color, OOColor::greenColor, OOColor::greenComponent, ShipEntity::hasHostileTarget, HPvector_subtract(), HPVectorToVector(), hudRotateViewpointForVirtualDepth(), int(), magnitude(), MAX_ACCURACY_RANGE, MIN_PROBABILITY_ACCURACY, nil, OODrawString(), OOGLBEGIN, OOGLEND, OOGLPopModelView(), OOGLPushModelView(), PLAYER, ShipEntity::primaryTarget, propertiesReticleTargetSensitive, OOColor::redColor, OOColor::redComponent, reticleTargetSensitive, ShipEntity::scanDescription, UNIVERSE, WH_SCANINFO_ARRIVAL_TIME, WH_SCANINFO_COLLAPSE_TIME, WH_SCANINFO_DESTINATION, WH_SCANINFO_NONE, WH_SCANINFO_SCANNED, WH_SCANINFO_SHIP, z1, and Entity::zero_distance.

Here is the call graph for this function:

◆ hudDrawStatusIconAt

+ (void) hudDrawStatusIconAt (int) x
(int) y
(int) z
(NSSize) siz 
implementation

Definition at line 3219 of file HeadUpDisplay.m.

3220{
3221 int ox = x - siz.width / 2.0;
3222 int oy = y - siz.height / 2.0;
3223 int w = siz.width / 4.0;
3224 int h = siz.height / 4.0;
3225
3226 glVertex3i(ox, oy + h, z);
3227 glVertex3i(ox, oy + 3 * h, z);
3228 glVertex3i(ox + w, oy + 4 * h, z);
3229 glVertex3i(ox + 3 * w, oy + 4 * h, z);
3230 glVertex3i(ox + 4 * w, oy + 3 * h, z);
3231 glVertex3i(ox + 4 * w, oy + h, z);
3232 glVertex3i(ox + 3 * w, oy, z);
3233 glVertex3i(ox + w, oy, z);
3234}

References x, and y.

◆ hudDrawSurroundAt

+ (void) hudDrawSurroundAt (GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3206 of file HeadUpDisplay.m.

3207{
3208 GLfloat dial_ox = x - siz.width / 2;
3209 GLfloat dial_oy = y - siz.height / 2;
3210
3211 OOGLBEGIN(GL_LINE_LOOP);
3212 glVertex3f(dial_ox - 2, dial_oy - 2, z);
3213 glVertex3f(dial_ox + siz.width + 2, dial_oy - 2, z);
3214 glVertex3f(dial_ox + siz.width + 2, dial_oy + siz.height + 2, z);
3215 glVertex3f(dial_ox - 2, dial_oy + siz.height + 2, z);
3216 OOGLEND();
3217}

References OOGLBEGIN, OOGLEND, x, and y.

◆ hudDrawWaypoint

+ (void) hudDrawWaypoint (OOWaypointEntity *) waypoint
(PlayerEntity *) player1
(GLfloat) z1
(GLfloat) alpha
(BOOL) selected
(GLfloat) scale 
implementation

Definition at line 3430 of file HeadUpDisplay.m.

3431{
3432 if ([player1 guiScreen] != GUI_SCREEN_MAIN) // don't draw on text screens
3433 {
3434 return;
3435 }
3436
3437 Vector p1 = HPVectorToVector(HPvector_subtract([waypoint position], [player1 viewpointPosition]));
3438
3441
3442 // either close enough that single precision is fine or far enough
3443 // away that precision is irrelevant
3444
3445 GLfloat rdist = magnitude(p1);
3446 GLfloat rsize = rdist * scale;
3447
3448 GLfloat rs0 = rsize;
3449 GLfloat rs2 = rsize * 0.50;
3450
3451 if (selected) {
3453 } else {
3454 GLColorWithOverallAlpha(blue_color, alpha * 0.25);
3455 }
3456
3457 OOGLBEGIN(GL_LINES);
3458 glVertex2f(rs0, rs2);
3459 glVertex2f(rs2, rs2);
3460 glVertex2f(rs2, rs0);
3461 glVertex2f(rs2, rs2);
3462
3463 glVertex2f(-rs0, rs2);
3464 glVertex2f(-rs2, rs2);
3465 glVertex2f(-rs2, rs0);
3466 glVertex2f(-rs2, rs2);
3467
3468 glVertex2f(-rs0, -rs2);
3469 glVertex2f(-rs2, -rs2);
3470 glVertex2f(-rs2, -rs0);
3471 glVertex2f(-rs2, -rs2);
3472
3473 glVertex2f(rs0, -rs2);
3474 glVertex2f(rs2, -rs2);
3475 glVertex2f(rs2, -rs0);
3476 glVertex2f(rs2, -rs2);
3477
3478 // glVertex2f(0,-rs2); glVertex2f(0,rs2);
3479 // glVertex2f(rs2,0); glVertex2f(-rs2,0);
3480 OOGLEND();
3481
3482 if (selected) {
3483 GLfloat range = HPdistance([player1 position], [waypoint position]) * 0.001f;
3484 if (range < 0.001f)
3485 range = 0.0f; // avoids the occasional -0.001 km distance.
3486 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3487 float line_height = rdist * scale;
3488 NSString* infoline = [NSString stringWithFormat:@"%0.3f %@", range, distance_unit];
3489 OODrawString(infoline, rs0 * 0.5, -rs2 - line_height, 0, textsize);
3490 }
3491
3493}
OOINLINE OOHPScalar HPdistance(HPVector v1, HPVector v2) INLINE_CONST_FUNC
Definition OOHPVector.h:298

References blue_color, GLColorWithOverallAlpha, HPdistance(), HPvector_subtract(), HPVectorToVector(), hudRotateViewpointForVirtualDepth(), magnitude(), OODrawString(), OOGLBEGIN, OOGLEND, OOGLPopModelView(), OOGLPushModelView(), and z1.

Here is the call graph for this function:

◆ hudName

- (NSString *) hudName

References hudName, and scannerZoom.

Here is the call graph for this function:

◆ hudRotateViewpointForVirtualDepth

+ (void) hudRotateViewpointForVirtualDepth (PlayerEntity *) player1
(Vector) p1 
implementation

Definition at line 3495 of file HeadUpDisplay.m.

3496{
3497 Quaternion back_q = [player1 orientation];
3498 back_q.w = -back_q.w; // invert
3499 Vector v1 = vector_up_from_quaternion(back_q);
3500 NSSize viewSize = [[UNIVERSE gameView] viewSize];
3501 float aspect = viewSize.width / viewSize.height;
3502
3503 // The field of view transformation is really a scale operation on the view window.
3504 // We must unapply it through these transformations for them to be right.
3505 // We must also take into account the window aspect ratio.
3506 float ratio = 2 * [[UNIVERSE gameView] fov:YES]; // FIXME 2 is magic number; fov should integrate it
3507 if (3.0f * aspect >= 4.0f) {
3508 OOGLScaleModelView(make_vector(1 / ratio, 1 / ratio, 1.0f));
3509 } else {
3510 OOGLScaleModelView(make_vector((4.0f / 3.0f) / (aspect * ratio), (4.0f / 3.0f) / (aspect * ratio), 1.0f));
3511 }
3512
3513 // deal with view directions
3514 Vector view_dir, view_up = kBasisYVector;
3515 switch ([UNIVERSE viewDirection]) {
3516 default:
3517 case VIEW_FORWARD:
3518 view_dir.x = 0.0;
3519 view_dir.y = 0.0;
3520 view_dir.z = 1.0;
3521 break;
3522
3523 case VIEW_AFT:
3524 view_dir.x = 0.0;
3525 view_dir.y = 0.0;
3526 view_dir.z = -1.0;
3527 quaternion_rotate_about_axis(&back_q, v1, M_PI);
3528 break;
3529
3530 case VIEW_PORT:
3531 view_dir.x = -1.0;
3532 view_dir.y = 0.0;
3533 view_dir.z = 0.0;
3534 quaternion_rotate_about_axis(&back_q, v1, 0.5 * M_PI);
3535 break;
3536
3537 case VIEW_STARBOARD:
3538 view_dir.x = 1.0;
3539 view_dir.y = 0.0;
3540 view_dir.z = 0.0;
3541 quaternion_rotate_about_axis(&back_q, v1, -0.5 * M_PI);
3542 break;
3543
3544 case VIEW_CUSTOM:
3545 view_dir = [player1 customViewForwardVector];
3546 view_up = [player1 customViewUpVector];
3547 back_q = quaternion_multiply([player1 customViewQuaternion], back_q);
3548 break;
3549 }
3550 OOGLLookAt(view_dir, kZeroVector, view_up);
3551
3552 // rotate the view
3553 OOGLMultModelView([player1 rotationMatrix]);
3554 // translate the view
3556 // rotate to face player1
3558
3559 // We come back now to the previous scale.
3560 OOGLScaleModelView(make_vector(ratio, ratio, 1.0f));
3561 // draw the waypoint
3562}
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Definition OOMatrix.m:56
void OOGLLookAt(Vector eye, Vector center, Vector up)
void OOGLMultModelView(OOMatrix matrix)
struct Quaternion Quaternion
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle) NONNULL_FUNC
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2) CONST_FUNC
Vector vector_up_from_quaternion(Quaternion quat) CONST_FUNC
const Vector kBasisYVector
Definition OOVector.h:46
Quaternion orientation
Definition Entity.m:682
Vector customViewUpVector
Vector customViewForwardVector
OOScalar w

References PlayerEntity::customViewForwardVector, PlayerEntity::customViewUpVector, kBasisYVector, kZeroVector, M_PI, make_vector(), OOGLLookAt(), OOGLMultModelView(), OOGLScaleModelView(), OOGLTranslateModelView(), OOMatrixForQuaternionRotation(), Entity::orientation, quaternion_multiply(), quaternion_rotate_about_axis(), UNIVERSE, vector_up_from_quaternion(), Quaternion::w, Vector::x, Vector::y, and Vector::z.

Here is the call graph for this function:

◆ IconForMissileRole

+ (OOPolygonSprite *) IconForMissileRole (NSString *) role
implementation

Definition at line 2311 of file HeadUpDisplay.m.

2312{
2313 static NSMutableDictionary* sIcons = nil;
2314 OOPolygonSprite* result = nil;
2315
2316 result = [sIcons objectForKey:role];
2317 if (result == nil) {
2318 NSString* key = role;
2319 NSArray* iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2320 if (iconDef != nil)
2321 result = [[OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2322 if (result == nil) // No custom icon or bad data
2323 {
2324 /* Backwards compatibility note:
2325 The old implementation used suffixes "MISSILE" and "MINE" (without
2326 the underscore), and didn't draw anything if neither was found. I
2327 believe any difference in practical behavour due to the change here
2328 will be positive.
2329 -- Ahruman 2009-10-09
2330 */
2331 if ([role hasSuffix:@"_MISSILE"])
2333 else
2334 key = kDefaultMineIconKey;
2335
2336 iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2337 result = [[OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2338 }
2339
2340 if (result != nil) {
2341 if (sIcons == nil)
2342 sIcons = [[NSMutableDictionary alloc] init];
2343 [sIcons setObject:result forKey:role];
2344 [result release]; // Balance alloc
2345 }
2346 }
2347
2348 return result;
2349}
static NSString *const kDefaultMineIconKey

References kDefaultMineIconKey, kDefaultMissileIconKey, and nil.

Referenced by drawIconForEmptyPylonAtX:y:width:height:alpha:, and drawIconForMissile:selected:status:x:y:width:height:alpha:.

Here is the caller graph for this function:

◆ InitTextEngine(void) [1/2]

+ (void InitTextEngine(void)) (void)
implementation

Definition at line 3564 of file HeadUpDisplay.m.

3565{
3566 NSDictionary* fontSpec = nil;
3567 NSArray* widths = nil;
3568 NSString* texName = nil;
3569 NSUInteger i, count;
3570
3571 fontSpec = [ResourceManager dictionaryFromFilesNamed:@"oolite-font.plist"
3572 inFolder:@"Config"
3573 andMerge:NO];
3574
3575 texName = [fontSpec oo_stringForKey:@"texture" defaultValue:@"oolite-font.png"];
3577 inFolder:@"Textures"
3578 options:kFontTextureOptions
3579 anisotropy:0.0f
3580 lodBias:-0.75f];
3581 [sFontTexture retain];
3582
3583 sF6KernGovt = [fontSpec oo_floatForKey:@"f6KernGovernment" defaultValue:1.0];
3584 sF6KernTL = [fontSpec oo_floatForKey:@"f6KernTechLevel" defaultValue:2.0];
3585
3586 sEncodingCoverter = [[OOEncodingConverter alloc] initWithFontPList:fontSpec];
3587 widths = [fontSpec oo_arrayForKey:@"widths"];
3588 count = [widths count];
3589 if (count > 256)
3590 count = 256;
3591 for (i = 0; i != count; ++i) {
3592 sGlyphWidths[i] = [widths oo_floatAtIndex:i] * GLYPH_SCALE_FACTOR;
3593 }
3594}
static float sF6KernGovt
static OOEncodingConverter * sEncodingCoverter
static OOTexture * sFontTexture
static float sF6KernTL
#define GLYPH_SCALE_FACTOR
unsigned count

References count, ResourceManager::dictionaryFromFilesNamed:inFolder:andMerge:, GLYPH_SCALE_FACTOR, nil, sEncodingCoverter, sF6KernGovt, sF6KernTL, sFontTexture, sGlyphWidths, and OOTexture::textureWithName:inFolder:options:anisotropy:lodBias:.

Here is the call graph for this function:

◆ InitTextEngine(void) [2/2]

+ (void InitTextEngine(void))
implementation

References prefetchData.

Here is the call graph for this function:

◆ initWithDictionary:

- (id) initWithDictionary: (NSDictionary*) hudinfo

Definition at line 210 of file HeadUpDisplay.m.

210 :(NSDictionary*)hudinfo
211{
212 return [self initWithDictionary:hudinfo inFile:nil];
213}

References initWithDictionary:inFile:.

Here is the call graph for this function:

◆ initWithDictionary:inFile:

- (id) initWithDictionary: (NSDictionary*) hudinfo
inFile: (NSString*) hudFileName 

Definition at line 215 of file HeadUpDisplay.m.

215 :(NSDictionary*)hudinfo inFile:(NSString*)hudFileName
216{
217 unsigned i;
218 BOOL isCompassToBeDrawn = NO;
219 BOOL areTrumblesToBeDrawn = NO;
220
221 self = [super init];
222
223 lineWidth = 1.0;
224
225 if (sFontTexture == nil)
226 InitTextEngine();
227
228 deferredHudName = nil; // if not nil, it means that we have a deferred HUD which is to be drawn at first available opportunity
229 hudName = [hudFileName copy];
230
231 // init arrays
232 dialArray = [[NSMutableArray alloc] initWithCapacity:16]; // alloc retains
233 legendArray = [[NSMutableArray alloc] initWithCapacity:16]; // alloc retains
234 mfdArray = [[NSMutableArray alloc] initWithCapacity:8]; // alloc retains
235
237
238 // populate arrays
239 NSArray* dials = [hudinfo oo_arrayForKey:DIALS_KEY];
240 for (i = 0; i < [dials count]; i++) {
241 NSDictionary* dial_info = [dials oo_dictionaryAtIndex:i];
242 if (!areTrumblesToBeDrawn && [[dial_info oo_stringForKey:SELECTOR_KEY] isEqualToString:@"drawTrumbles:"])
243 areTrumblesToBeDrawn = YES;
244 if (!isCompassToBeDrawn && [[dial_info oo_stringForKey:SELECTOR_KEY] isEqualToString:@"drawCompass:"])
245 isCompassToBeDrawn = YES;
246 if ([[dial_info oo_stringForKey:SELECTOR_KEY] isEqualToString:@"drawTargetReticle:"]) {
247 _reticleColors = [[NSMutableArray arrayWithObjects:[OOColor colorWithDescription:[dial_info oo_objectForKey:@"target_rgba" defaultValue:@"greenColor"]],
248 [OOColor colorWithDescription:[dial_info oo_objectForKey:@"target_sensitive_rgba" defaultValue:@"redColor"]],
249 [OOColor colorWithDescription:[dial_info oo_objectForKey:@"wormhole_rgba" defaultValue:@"cyanColor"]],
250 nil] retain];
251 }
252 [self addDial:dial_info];
253 }
254
255 // reticle colors should be set at this point, but just be safe in case they are not
256 if (!_reticleColors) {
257 _reticleColors = [[NSMutableArray arrayWithObjects:[OOColor greenColor], [OOColor redColor], [OOColor cyanColor], nil] retain];
258 }
259
260 if (!areTrumblesToBeDrawn) // naughty - a hud with no built-in drawTrumbles: - one must be added!
261 {
262 NSDictionary* trumble_dial_info = [NSDictionary dictionaryWithObjectsAndKeys:@"drawTrumbles:", SELECTOR_KEY, nil];
263 [self addDial:trumble_dial_info];
264 }
265
266 _compassActive = isCompassToBeDrawn;
267
269
270 NSArray* legends = [hudinfo oo_arrayForKey:LEGENDS_KEY];
271 for (i = 0; i < [legends count]; i++) {
272 [self addLegend:[legends oo_dictionaryAtIndex:i]];
273 }
274
275 NSArray* mfds = [hudinfo oo_arrayForKey:MFDS_KEY];
276 for (i = 0; i < [mfds count]; i++) {
277 [self addMFD:[mfds oo_dictionaryAtIndex:i]];
278 }
279
280 hudHidden = NO;
281
282 _hiddenSelectors = [[NSMutableSet alloc] initWithCapacity:16];
283
284 hudUpdating = NO;
285
286 overallAlpha = [hudinfo oo_floatForKey:@"overall_alpha" defaultValue:DEFAULT_OVERALL_ALPHA];
287
288 reticleTargetSensitive = [hudinfo oo_boolForKey:@"reticle_target_sensitive" defaultValue:NO];
289 propertiesReticleTargetSensitive = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
290 [NSNumber numberWithBool:YES], @"isAccurate",
291 [NSNumber numberWithDouble:[UNIVERSE getTime]], @"timeLastAccuracyProbabilityCalculation",
292 nil];
293
294 cloakIndicatorOnStatusLight = [hudinfo oo_boolForKey:@"cloak_indicator_on_status_light" defaultValue:YES];
295
296 allowBigGui = [hudinfo oo_boolForKey:@"allow_big_gui" defaultValue:NO];
297
299
300 [crosshairDefinition release];
301
302 NSString* crossfile = [[hudinfo oo_stringForKey:@"crosshair_file"] retain];
303 if (crossfile == nil) {
304 _crosshairOverrides = [[hudinfo oo_dictionaryForKey:@"crosshairs"] retain];
306 } else {
307 [self setCrosshairDefinition:crossfile];
308 }
309 [crossfile release];
310
311 id crosshairColor = [hudinfo oo_objectForKey:@"crosshair_color" defaultValue:@"greenColor"];
312 _crosshairColor = [[OOColor colorWithDescription:crosshairColor] retain];
313 _crosshairScale = [hudinfo oo_floatForKey:@"crosshair_scale" defaultValue:32.0f];
314 _crosshairWidth = [hudinfo oo_floatForKey:@"crosshair_width" defaultValue:1.5f];
315
316 minimalistic_scanner = [hudinfo oo_boolForKey:@"scanner_minimalistic" defaultValue:NO];
317
318 nonlinear_scanner = [hudinfo oo_boolForKey:@"scanner_non_linear" defaultValue:NO];
319 scanner_ultra_zoom = [hudinfo oo_boolForKey:@"scanner_ultra_zoom" defaultValue:NO];
320
321 distance_unit = DESC(@"oolite-hud-distance-unit");
322
323 return self;
324}
#define SELECTOR_KEY
static NSString * distance_unit
@ NO_TARGET
Definition OOTypes.h:169
GLfloat _crosshairScale
OOColor * cyanColor()
Definition OOColor.m:274

References _compassActive, _crosshairColor, _crosshairOverrides, _crosshairScale, _crosshairWidth, _hiddenSelectors, _lastWeaponType, _reticleColors, addDial:, addLegend:, addMFD:, allowBigGui, cloakIndicatorOnStatusLight, OOColor::colorWithDescription:, crosshairDefinition, OOColor::cyanColor, deferredHudName, DESC, dialArray, distance_unit, OOColor::greenColor, hudHidden, hudName, hudUpdating, last_transmitter, legendArray, lineWidth, mfdArray, minimalistic_scanner, nil, NO_TARGET, nonlinear_scanner, overallAlpha, propertiesReticleTargetSensitive, OOColor::redColor, reticleTargetSensitive, scanner_ultra_zoom, SELECTOR_KEY, setCrosshairDefinition:, and sFontTexture.

Referenced by initWithDictionary:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCompassActive

- (BOOL) isCompassActive

Definition at line 610 of file HeadUpDisplay.m.

611{
612 return _compassActive;
613}

References _compassActive, and isCompassActive.

Referenced by allowBigGui, isCompassActive, and PlayerEntity::switchHudTo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isHidden

- (BOOL) isHidden

Definition at line 573 of file HeadUpDisplay.m.

574{
575 return hudHidden;
576}

References hudHidden, and isHidden.

Referenced by isHidden, PlayerEntity(OOControlsPrivate)::pollApplicationControls, propertiesReticleTargetSensitive, and PlayerEntity::switchHudTo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isUpdating

- (BOOL) isUpdating

Definition at line 620 of file HeadUpDisplay.m.

621{
622 return hudUpdating;
623}

References hudUpdating, and isUpdating.

Referenced by allowBigGui, and isUpdating.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lineWidth

- (GLfloat) lineWidth

References lineWidth, minimalisticScanner, nonlinearScanner, and scannerUltraZoom.

Here is the call graph for this function:

◆ mfdCount

- (NSUInteger) mfdCount

Definition at line 722 of file HeadUpDisplay.m.

723{
724 return [mfdArray count];
725}

References mfdCount.

Referenced by crosshairDefinition, mfdCount, PlayerEntity::selectPreviousMultiFunctionDisplay, and PlayerEntity::switchHudTo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimalisticScanner

- (BOOL) minimalisticScanner

Definition at line 1361 of file HeadUpDisplay.m.

1362{
1363 return minimalistic_scanner;
1364}

References minimalistic_scanner, and minimalisticScanner.

Referenced by lineWidth, and minimalisticScanner.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nonlinearScanner

- (BOOL) nonlinearScanner

Definition at line 1378 of file HeadUpDisplay.m.

1379{
1380 return nonlinear_scanner;
1381}

References nonlinear_scanner, and nonlinearScanner.

Referenced by lineWidth, and nonlinearScanner.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nonlinearScannerFunc

+ (GLfloat) nonlinearScannerFunc (GLfloat) distance
(GLfloat) zoom
(GLfloat) scale 
implementation

Definition at line 3901 of file HeadUpDisplay.m.

3902{
3903 GLfloat x = fabs(distance / SCANNER_MAX_RANGE);
3904 if (x >= 1.0)
3905 return scale;
3906 if (zoom <= 1.0)
3907 return scale * x;
3908 GLfloat c = 1 / (zoom - 1);
3909 GLfloat b = c * (c + 1);
3910 GLfloat a = c + 1;
3911 return scale * (a - b / (x + c));
3912}
OOINLINE OOScalar distance(Vector v1, Vector v2) INLINE_CONST_FUNC
Definition OOVector.h:280

References distance(), SCANNER_MAX_RANGE, and x.

Here is the call graph for this function:

◆ nonlinearScannerScale:Zoom:Scale:

+ (Vector) nonlinearScannerScale: (Vector) V
Zoom: (GLfloat) zoom
Scale: (double) scale 

Definition at line 1371 of file HeadUpDisplay.m.

1371 :(Vector)V Zoom:(GLfloat)zoom Scale:(double)scale
1372{
1373 OOScalar mag = magnitude(V);
1374 Vector unit = vector_normal(V);
1375 return vector_multiply_scalar(unit, nonlinearScannerFunc(mag, zoom, scale));
1376}
GLfloat OOScalar
Definition OOMaths.h:49
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
Definition OOVector.h:180

References magnitude(), nonlinearScannerFunc(), vector_multiply_scalar(), and vector_normal().

Referenced by HeadUpDisplay(Private)::drawScanner:, and GLDrawNonlinearCascadeWeapon.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OODrawHilightedPlanetInfo

- (void) OODrawHilightedPlanetInfo (int) gov
(int) eco
(int) tec
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3802 of file HeadUpDisplay.m.

3803{
3804 float color[4];
3805 int tl = tec + 1;
3806
3807 NSSize hisize;
3808
3809 // get the physical dimensions
3810 hisize.height = siz.height;
3811 hisize.width = 0.0f;
3812
3813 // see OODrawPlanetInfo
3814 hisize.width += siz.width * sGlyphWidths[23 - eco];
3815 hisize.width += siz.width * sGlyphWidths[gov] - 1.0;
3816 if (tl > 9)
3817 hisize.width += siz.width * sGlyphWidths[49] - 2.0;
3818 hisize.width += siz.width * sGlyphWidths[48 + (tl % 10)];
3819
3821
3822 OOGL(glPushAttrib(GL_CURRENT_BIT)); // save the text colour
3823 OOGL(glGetFloatv(GL_CURRENT_COLOR, color)); // we need the original colour's alpha.
3824
3825 drawHighlight(x, y - 2.0f, z, hisize, color[3]);
3826
3827 OOGL(glPopAttrib()); // restore the colour
3828
3829 OODrawPlanetInfo(gov, eco, tec, x, y, z, siz);
3830
3832}
void drawHighlight(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat alpha)
void OODrawPlanetInfo(int gov, int eco, int tec, GLfloat x, GLfloat y, GLfloat z, NSSize siz)

References drawHighlight, OODrawPlanetInfo(), OOGL, OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_OVERLAY, sGlyphWidths, x, and y.

Here is the call graph for this function:

◆ OODrawHilightedString

- (void) OODrawHilightedString (NSString *) text
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3727 of file HeadUpDisplay.m.

3728{
3729 GLfloat color[4];
3730
3731 // get the physical dimensions of the string
3732 NSSize strsize = OORectFromString(text, 0.0f, 0.0f, siz).size;
3733 strsize.width += 0.5f;
3734
3736
3737 OOGL(glPushAttrib(GL_CURRENT_BIT)); // save the text colour
3738 OOGL(glGetFloatv(GL_CURRENT_COLOR, color)); // we need the original colour's alpha.
3739
3740 drawHighlight(x, y, z, strsize, color[3]);
3741
3742 OOGL(glPopAttrib()); // restore the colour
3743
3744 OODrawString(text, x, y, z, siz);
3745
3747}
NSRect OORectFromString(NSString *text, GLfloat x, GLfloat y, NSSize siz)

References drawHighlight, OODrawString(), OOGL, OORectFromString(), OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_OVERLAY, x, and y.

Here is the call graph for this function:

◆ OODrawPlanetInfo

- (void) OODrawPlanetInfo (int) gov
(int) eco
(int) tec
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3749 of file HeadUpDisplay.m.

3750{
3751 GLfloat govcol[] = { 0.5, 0.0, 0.7,
3752 0.7, 0.5, 0.3,
3753 0.0, 1.0, 0.3,
3754 1.0, 0.8, 0.1,
3755 1.0, 0.0, 0.0,
3756 0.1, 0.5, 1.0,
3757 0.7, 0.7, 0.7,
3758 0.7, 1.0, 1.0 };
3759
3760 GLfloat cx = x;
3761 int tl = tec + 1;
3762 GLfloat ce1 = 1.0f - 0.125f * eco;
3763
3765
3766 OOGL(glEnable(GL_TEXTURE_2D));
3768
3769 OOGLBEGIN(GL_QUADS);
3770 {
3771 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartEconomyUColor, (size_t)eco]
3772 defaultValue:[OOColor colorWithRed:ce1 green:1.0f blue:0.0f alpha:1.0f]
3773 alpha:1.0];
3774
3775 // see OODrawHilightedPlanetInfo
3776 cx += drawCharacterQuad(23 - eco, cx, y, z, siz); // characters 16..23 are economy symbols
3777 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartGovernmentUColor, (size_t)gov]
3778 defaultValue:[OOColor colorWithRed:govcol[gov * 3] green:govcol[1 + (gov * 3)] blue:govcol[2 + (gov * 3)] alpha:1.0f]
3779 alpha:1.0];
3780
3781 cx += drawCharacterQuad(gov, cx, y, z, siz) - sF6KernGovt; // charcters 0..7 are government symbols
3782 [[UNIVERSE gui] setGLColorFromSetting:kGuiChartTechColor
3783 defaultValue:[OOColor colorWithRed:0.5 green:1.0f blue:1.0f alpha:1.0f]
3784 alpha:1.0];
3785
3786 if (tl > 9) {
3787 // display TL clamped between 1..16, this must be a '1'!
3788 cx += drawCharacterQuad(49, cx, y - 2, z, siz) - sF6KernTL;
3789 }
3790 cx += drawCharacterQuad(48 + (tl % 10), cx, y - 2.0f, z, siz);
3791 }
3792 OOGLEND();
3793
3794 (void)cx; // Suppress "value not used" analyzer issue.
3795
3797 OOGL(glDisable(GL_TEXTURE_2D));
3798
3800}
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
Definition OOColor.m:107

References OOTexture::apply, OOTexture::applyNone, OOColor::colorWithRed:green:blue:alpha:, drawCharacterQuad, OOGL, OOGLBEGIN, OOGLEND, OOSetOpenGLState, OOVerifyOpenGLState, OPENGL_STATE_OVERLAY, sF6KernGovt, sF6KernTL, x, and y.

Here is the call graph for this function:

◆ OODrawString

- (void) OODrawString (NSString *) text
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz 
implementation

Definition at line 3676 of file HeadUpDisplay.m.

3677{
3678 OODrawStringAligned(text, x, y, z, siz, NO);
3679}

References OODrawStringAligned(), x, and y.

Here is the call graph for this function:

◆ OODrawStringAligned

- (void) OODrawStringAligned (NSString *) text
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(BOOL) rightAlign 
implementation

Definition at line 3681 of file HeadUpDisplay.m.

3682{
3684 OODrawStringQuadsAligned(text, x, y, z, siz, rightAlign);
3686}
void OOStopDrawingStrings()
void OODrawStringQuadsAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
void OOStartDrawingStrings()

References OODrawStringQuadsAligned(), OOStartDrawingStrings(), OOStopDrawingStrings(), x, and y.

Here is the call graph for this function:

◆ OODrawStringQuadsAligned

- (void) OODrawStringQuadsAligned (NSString *) text
(GLfloat) x
(GLfloat) y
(GLfloat) z
(NSSize) siz
(BOOL) rightAlign 
implementation

Definition at line 3697 of file HeadUpDisplay.m.

3698{
3699 GLfloat cx = x;
3700 NSInteger i, length;
3701 NSData* data = nil;
3702 const uint8_t* bytes = NULL;
3703
3704 data = [sEncodingCoverter convertString:text];
3705 length = [data length];
3706 bytes = [data bytes];
3707
3708 if (EXPECT_NOT(rightAlign)) {
3709 cx -= OORectFromString(text, 0.0f, 0.0f, siz).size.width;
3710 }
3711
3712 for (i = 0; i < length; i++) {
3713 cx += drawCharacterQuad(bytes[i], cx, y, z, siz);
3714 }
3715}
NSData * convertString:(NSString *string)

References OOEncodingConverter::convertString:, drawCharacterQuad, EXPECT_NOT, nil, OORectFromString(), x, and y.

Here is the call graph for this function:

◆ OOHUDResetTextEngine(void)

- (void OOHUDResetTextEngine(void)) (void)
implementation

Definition at line 3596 of file HeadUpDisplay.m.

3597{
3600}

References DESTROY, sEncodingCoverter, and sFontTexture.

◆ OORectFromString

- (NSRect) OORectFromString (NSString *) text
(GLfloat) x
(GLfloat) y
(NSSize) siz 
implementation

Definition at line 3624 of file HeadUpDisplay.m.

3625{
3626 GLfloat w = 0;
3627 NSData* data = nil;
3628 const uint8_t* bytes = NULL;
3629 NSUInteger i, length;
3630
3631 data = [sEncodingCoverter convertString:text];
3632 bytes = [data bytes];
3633 length = [data length];
3634
3635 for (i = 0; i < length; i++) {
3636 w += siz.width * sGlyphWidths[bytes[i]];
3637 }
3638
3639 return NSMakeRect(x, y, w, siz.height);
3640}

References OOEncodingConverter::convertString:, nil, sGlyphWidths, x, and y.

Here is the call graph for this function:

◆ OOStartDrawingStrings

- (void) OOStartDrawingStrings
implementation

Definition at line 3688 of file HeadUpDisplay.m.

3689{
3691
3692 OOGL(glEnable(GL_TEXTURE_2D));
3694 OOGLBEGIN(GL_QUADS);
3695}

References OOTexture::apply, OOGL, OOGLBEGIN, OOSetOpenGLState, and OPENGL_STATE_OVERLAY.

Here is the call graph for this function:

◆ OOStopDrawingStrings

- (void) OOStopDrawingStrings
implementation

Definition at line 3717 of file HeadUpDisplay.m.

3718{
3719 OOGLEND();
3720
3722 OOGL(glDisable(GL_TEXTURE_2D));
3723
3725}

References OOTexture::applyNone, OOGL, OOGLEND, and OOVerifyOpenGLState.

Here is the call graph for this function:

◆ OOStringWidthInEm

- (CGFloat) OOStringWidthInEm (NSString *) text
implementation

Definition at line 3642 of file HeadUpDisplay.m.

3643{
3644 return OORectFromString(text, 0, 0, NSMakeSize(1.0 / (GLYPH_SCALE_FACTOR * 8.0), 1.0)).size.width;
3645}

References GLYPH_SCALE_FACTOR, and OORectFromString().

Here is the call graph for this function:

◆ overallAlpha

- (GLfloat) overallAlpha

References overallAlpha.

◆ prefetchData

+ (void) prefetchData (NSDictionary *) info
(struct CachedInfo *) data 
implementation

Definition at line 1043 of file HeadUpDisplay.m.

1044{
1045 data->x = [info oo_floatForKey:X_KEY defaultValue:NOT_DEFINED];
1046 data->x0 = [info oo_floatForKey:X_ORIGIN_KEY defaultValue:0.0];
1047 data->y = [info oo_floatForKey:Y_KEY defaultValue:NOT_DEFINED];
1048 data->y0 = [info oo_floatForKey:Y_ORIGIN_KEY defaultValue:0.0];
1049 data->width = [info oo_floatForKey:WIDTH_KEY defaultValue:NOT_DEFINED];
1050 data->height = [info oo_floatForKey:HEIGHT_KEY defaultValue:NOT_DEFINED];
1051 data->alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f];
1052}

References CachedInfo::alpha, CachedInfo::height, prefetchData, CachedInfo::width, CachedInfo::x, CachedInfo::x0, CachedInfo::y, and CachedInfo::y0.

Referenced by addDial:, addLegend:, addMFD:, InitTextEngine(void), and prefetchData.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertiesReticleTargetSensitive

- (NSMutableDictionary *) propertiesReticleTargetSensitive

References isHidden, and propertiesReticleTargetSensitive.

Here is the call graph for this function:

◆ refreshLastTransmitter

- (void) refreshLastTransmitter

Definition at line 1398 of file HeadUpDisplay.m.

1399{
1400 Entity* lt = [UNIVERSE entityForUniversalID:last_transmitter];
1401 if ((lt == nil) || (!(lt->isShip)))
1402 return;
1403 ShipEntity* st = (ShipEntity*)lt;
1404 if ([st messageTime] <= 0.0)
1405 [st setMessageTime:2.5];
1406}
unsigned isShip
Definition Entity.m:125
void setMessageTime:(double value)

References Entity::isShip, nil, refreshLastTransmitter, and ShipEntity::setMessageTime:.

Referenced by crosshairDefinition, and refreshLastTransmitter.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderHUD

- (void) renderHUD

Definition at line 754 of file HeadUpDisplay.m.

755{
756 hudUpdating = YES;
757
759
760 if ((_crosshairWidth * lineWidth) > 0) {
762 [self drawCrosshairs];
763 }
764
765 if (lineWidth > 0) {
767 [self drawLegends];
768 }
769
770 [self drawDials];
771 [self drawMFDs];
772 OOCheckOpenGLErrors(@"After drawing HUD");
773
775
776 hudUpdating = NO;
777}

References _crosshairWidth, drawCrosshairs, drawDials, drawLegends, drawMFDs, GLScaledLineWidth(), hudUpdating, lineWidth, OOCheckOpenGLErrors(), OOGL, OOVerifyOpenGLState, and renderHUD.

Referenced by crosshairDefinition, Universe::drawUniverse, and renderHUD.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetGui:withInfo:

- (void) resetGui: (GuiDisplayGen*) gui
withInfo: (NSDictionary*) gui_info 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 345 of file HeadUpDisplay.m.

345 :(GuiDisplayGen*)gui withInfo:(NSDictionary*)gui_info
346{
347 [self resetGuiPosition:gui withInfo:gui_info];
348
349 NSSize siz = [gui size];
350 int rht = [gui rowHeight];
351 NSString* title = [gui title];
352 if ([gui_info objectForKey:WIDTH_KEY])
353 siz.width = [gui_info oo_floatForKey:WIDTH_KEY];
354 if ([gui_info objectForKey:HEIGHT_KEY])
355 siz.height = [gui_info oo_floatForKey:HEIGHT_KEY];
356 if ([gui_info objectForKey:ROW_HEIGHT_KEY])
357 rht = [gui_info oo_floatForKey:ROW_HEIGHT_KEY];
358 if ([gui_info objectForKey:TITLE_KEY])
359 title = [gui_info oo_stringForKey:TITLE_KEY];
360 [gui resizeTo:siz characterHeight:rht title:title];
361 if ([gui_info objectForKey:BACKGROUND_RGBA_KEY])
362 [gui setBackgroundColor:[OOColor colorFromString:[gui_info oo_stringForKey:BACKGROUND_RGBA_KEY]]];
363 if ([gui_info objectForKey:ALPHA_KEY])
364 [gui setMaxAlpha:OOClamp_0_max_f([gui_info oo_floatForKey:ALPHA_KEY], 1.0f)];
365 else
366 [gui setMaxAlpha:1.0f];
367}
#define ROW_HEIGHT_KEY
#define HEIGHT_KEY
#define WIDTH_KEY
#define TITLE_KEY
#define BACKGROUND_RGBA_KEY
#define ALPHA_KEY
OOINLINE float OOClamp_0_max_f(float value, float max) INLINE_CONST_FUNC
void resizeTo:characterHeight:title:(NSSize gui_size,[characterHeight] int csize,[title] NSString *gui_title)
void setMaxAlpha:(GLfloat an_alpha)
NSString * title
unsigned rowHeight()

References ALPHA_KEY, BACKGROUND_RGBA_KEY, OOColor::colorFromString:, HEIGHT_KEY, resetGuiPosition:withInfo:, GuiDisplayGen::resizeTo:characterHeight:title:, ROW_HEIGHT_KEY, GuiDisplayGen::rowHeight, GuiDisplayGen::setBackgroundColor:, GuiDisplayGen::setMaxAlpha:, GuiDisplayGen::size, GuiDisplayGen::title, TITLE_KEY, and WIDTH_KEY.

Referenced by resetGuis:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetGuiPosition:withInfo:

- (void) resetGuiPosition: (GuiDisplayGen*) gui
withInfo: (NSDictionary*) gui_info 
implementation

Provided by category HeadUpDisplay(Private).

Definition at line 369 of file HeadUpDisplay.m.

369 :(GuiDisplayGen*)gui withInfo:(NSDictionary*)gui_info
370{
371 Vector pos = [gui drawPosition];
372 if ([gui_info objectForKey:X_KEY])
373 pos.x = [gui_info oo_floatForKey:X_KEY] +
374 [[UNIVERSE gameView] x_offset] *
375 [gui_info oo_floatForKey:X_ORIGIN_KEY
376 defaultValue:0.0];
377 if ([gui_info objectForKey:Y_KEY])
378 pos.y = [gui_info oo_floatForKey:Y_KEY] +
379 [[UNIVERSE gameView] y_offset] *
380 [gui_info oo_floatForKey:Y_ORIGIN_KEY
381 defaultValue:0.0];
382
383 [gui setDrawPosition:pos];
384}
#define X_ORIGIN_KEY
#define Y_ORIGIN_KEY
#define X_KEY
#define Y_KEY

References GuiDisplayGen::drawPosition, GuiDisplayGen::setDrawPosition:, Vector::x, X_KEY, Vector::y, and Y_KEY.

Referenced by HeadUpDisplay(Private)::resetGui:withInfo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetGuis:

- (void) resetGuis: (NSDictionary*) info

Definition at line 386 of file HeadUpDisplay.m.

386 :(NSDictionary*)info
387{
388 // check for entries in hud.plist for message_gui and comm_log_gui
389 // then resize and reposition them accordingly.
390
391 GuiDisplayGen* gui = [UNIVERSE messageGUI];
392 NSDictionary* gui_info = [info oo_dictionaryForKey:@"message_gui"];
393 if (gui && [gui_info count] > 0) {
394 /*
395 If switching message guis, remember the last 2 message lines.
396 Present GUI limitations make it impractical to transfer anything
397 more...
398
399 TODO: a more usable GUI code! - Kaks 2011.11.05
400 */
401
402 NSArray* lastLines = [gui getLastLines]; // text, colour, fade time - text, colour, fade time
403 BOOL line1 = ![[lastLines oo_stringAtIndex:0] isEqualToString:@""];
404 [self resetGui:gui withInfo:gui_info];
405
406 BOOL permanent = [gui_info oo_boolForKey:@"permanent" defaultValue:NO];
407 [UNIVERSE setPermanentMessageLog:permanent];
408
409 BOOL automaticBg = [gui_info oo_boolForKey:@"background_automatic" defaultValue:YES];
410 [UNIVERSE setAutoMessageLogBg:automaticBg];
411
412 // set message gui text colors - one for standard messages, one for incoming comms
413 // incoming comms message color must default to green for compatibility with older huds that
414 // don't have this key
415 [gui setTextColor:[OOColor colorWithDescription:[gui_info objectForKey:@"text_color"]]];
416 OOColor* textCommsColor = [OOColor colorWithDescription:[gui_info objectForKey:@"text_comms_color"]];
417 if (!textCommsColor)
418 textCommsColor = [OOColor greenColor];
419 [gui setTextCommsColor:textCommsColor];
420
421 if (line1) {
422 [gui printLongText:[lastLines oo_stringAtIndex:0]
423 align:GUI_ALIGN_CENTER
424 color:[OOColor colorFromString:[lastLines oo_stringAtIndex:1]]
425 fadeTime:(permanent ? 0.0 : [lastLines oo_floatAtIndex:2])key:nil
426 addToArray:nil];
427 }
428 if ([lastLines count] > 3 && (line1 || ![[lastLines oo_stringAtIndex:3] isEqualToString:@""])) {
429 [gui printLongText:[lastLines oo_stringAtIndex:3]
430 align:GUI_ALIGN_CENTER
431 color:[OOColor colorFromString:[lastLines oo_stringAtIndex:4]]
432 fadeTime:(permanent ? 0.0 : [lastLines oo_floatAtIndex:5])key:nil
433 addToArray:nil];
434 }
435 }
436
437 if (gui_info != nil && [gui_info count] == 0) {
438 // exists and it's empty. complete reset.
439 [gui setCurrentRow:8];
440 [gui setDrawPosition:make_vector(0.0, -40.0, 640.0)];
441 [gui resizeTo:NSMakeSize(480, 160) characterHeight:19 title:nil];
442 [gui setCharacterSize:NSMakeSize(16, 20)]; // narrow characters
445 [UNIVERSE setPermanentMessageLog:NO];
446 [UNIVERSE setAutoMessageLogBg:YES];
447 }
448
449 [gui setAlpha:1.0f]; // message_gui is always visible.
450
451 // And now set up the comms log
452
453 gui = [UNIVERSE commLogGUI];
454 gui_info = [info oo_dictionaryForKey:@"comm_log_gui"];
455
456 if (gui && [gui_info count] > 0) {
457 [UNIVERSE setAutoCommLog:[gui_info oo_boolForKey:@"automatic" defaultValue:YES]];
458 [UNIVERSE setPermanentCommLog:[gui_info oo_boolForKey:@"permanent" defaultValue:NO]];
459
460 /*
461 We need to repopulate the comms log after resetting it.
462
463 At the moment the colour information is set on a per-line basis, rather than a per-text basis.
464 A comms message can span multiple lines, and two consecutive messages can share the same colour,
465 so trying to match the colour information from the GUI with each message won't work.
466
467 Bottom line: colour information is lost on comms log gui reset.
468 And yes, this is yet another reason for the following
469
470 TODO: a more usable GUI code! - Kaks 2011.11.05
471 */
472
473 NSArray* cLog = [PLAYER commLog];
474 NSUInteger i, commCount = [cLog count];
475
476 [self resetGui:gui withInfo:gui_info];
477
478 for (i = 0; i < commCount; i++) {
479 [gui printLongText:[cLog oo_stringAtIndex:i]
480 align:GUI_ALIGN_LEFT
481 color:nil
482 fadeTime:0.0
483 key:nil
484 addToArray:nil];
485 }
486 }
487
488 if (gui_info != nil && [gui_info count] == 0) {
489 // exists and it's empty. complete reset.
490 [UNIVERSE setAutoCommLog:YES];
491 [UNIVERSE setPermanentCommLog:NO];
492 [gui setCurrentRow:9];
493 [gui setDrawPosition:make_vector(0.0, 180.0, 640.0)];
494 [gui resizeTo:NSMakeSize(360, 120) characterHeight:12 title:nil];
495 [gui setBackgroundColor:[OOColor colorWithRed:0.0 green:0.05 blue:0.45 alpha:0.5]];
497 [gui printLongText:DESC(@"communications-log-string") align:GUI_ALIGN_CENTER color:[OOColor yellowColor] fadeTime:0 key:nil addToArray:nil];
498 }
499
500 if ([UNIVERSE permanentCommLog]) {
501 [gui stopFadeOuts];
502 [gui setAlpha:1.0];
503 } else {
504 [gui setAlpha:0.0];
505 }
506}
void setTextColor:(OOColor *color)
void setDrawPosition:(Vector vector)
void setCharacterSize:(NSSize character_size)
NSArray * getLastLines()
void setBackgroundColor:(OOColor *color)
void printLongText:align:color:fadeTime:key:addToArray:(NSString *str,[align] OOGUIAlignment alignment,[color] OOColor *text_color,[fadeTime] float text_fade,[key] NSString *text_key,[addToArray] NSMutableArray *text_array)
void setTextCommsColor:(OOColor *color)
void setAlpha:(GLfloat an_alpha)
void setCurrentRow:(OOGUIRow value)
OOColor * colorFromString:(NSString *colorFloatString)
Definition OOColor.m:211
OOColor * whiteColor()
Definition OOColor.m:249
OOColor * yellowColor()
Definition OOColor.m:279

References OOColor::colorFromString:, OOColor::colorWithDescription:, OOColor::colorWithRed:green:blue:alpha:, count, GuiDisplayGen::getLastLines, OOColor::greenColor, nil, GuiDisplayGen::printLongText:align:color:fadeTime:key:addToArray:, resetGui:withInfo:, GuiDisplayGen::resizeTo:characterHeight:title:, GuiDisplayGen::setAlpha:, GuiDisplayGen::setBackgroundColor:, GuiDisplayGen::setCharacterSize:, GuiDisplayGen::setCurrentRow:, GuiDisplayGen::setDrawPosition:, GuiDisplayGen::setTextColor:, GuiDisplayGen::setTextCommsColor:, GuiDisplayGen::stopFadeOuts, UNIVERSE, OOColor::whiteColor, and OOColor::yellowColor.

Referenced by PlayerEntity::deferredInit, and PlayerEntity::switchHudTo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reticleColorForIndex:

- (OOColor *) reticleColorForIndex: (NSUInteger) idx

Definition at line 521 of file HeadUpDisplay.m.

521 :(NSUInteger)idx
522{
523 if (idx < [_reticleColors count]) {
524 return [_reticleColors objectAtIndex:idx];
525 }
526 return nil;
527}

References _reticleColors, count, and nil.

Referenced by PlayerShipGetProperty(), and PlayerShipGetProperty().

Here is the caller graph for this function:

◆ reticleTargetSensitive

◆ scannerUltraZoom

- (BOOL) scannerUltraZoom

Definition at line 1388 of file HeadUpDisplay.m.

1389{
1390 return scanner_ultra_zoom;
1391}

References scanner_ultra_zoom, and scannerUltraZoom.

Referenced by lineWidth, and scannerUltraZoom.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scannerZoom

- (GLfloat) scannerZoom

Definition at line 538 of file HeadUpDisplay.m.

539{
540 return scanner_zoom;
541}

References scanner_zoom, and scannerZoom.

Referenced by PlayerEntity::commanderDataDictionary, PlayerEntity::doBookkeeping:, hudName, scannerZoom, and PlayerEntity::switchHudTo:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCompassActive:

- (void) setCompassActive: (BOOL) newValue

Definition at line 615 of file HeadUpDisplay.m.

615 :(BOOL)newValue
616{
617 _compassActive = !!newValue;
618}

References _compassActive.

Referenced by PlayerEntity(OOPrivate)::noteCompassLostTarget, and PlayerEntity::switchHudTo:.

Here is the caller graph for this function:

◆ SetCompassBlipColor

- (OOINLINE void) SetCompassBlipColor (GLfloat) relativeZ
(GLfloat) alpha 
implementation

Definition at line 1555 of file HeadUpDisplay.m.

1556{
1557 if (relativeZ >= 0.0f) {
1558 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1559 } else {
1560 OOGL(glColor4f(1.0f, 0.0f, 0.0f, alpha));
1561 }
1562}

References OOGL, and OOINLINE.

◆ setCrosshairDefinition:

- (BOOL) setCrosshairDefinition: (NSString*) newDefinition

Definition at line 866 of file HeadUpDisplay.m.

866 :(NSString*)newDefinition
867{
868 // force crosshair redraw
869 [_crosshairs release];
871
872 [_crosshairOverrides release];
874 inFolder:@"Config"
875 andMerge:YES] retain];
876 if (_crosshairOverrides == nil || [_crosshairOverrides count] == 0) { // invalid file
877 [_crosshairOverrides release];
879 inFolder:@"Config"
880 andMerge:YES] retain];
881 crosshairDefinition = @"crosshairs.plist";
882 return NO;
883 }
884 crosshairDefinition = [newDefinition copy];
885 return YES;
886}

References _crosshairOverrides, _crosshairs, count, crosshairDefinition, ResourceManager::dictionaryFromFilesNamed:inFolder:andMerge:, and nil.

Referenced by initWithDictionary:inFile:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDeferredHudName:

- (void) setDeferredHudName: (NSString*) newDeferredHudName

Definition at line 625 of file HeadUpDisplay.m.

625 :(NSString*)newDeferredHudName
626{
627 [deferredHudName release];
628 deferredHudName = [newDeferredHudName copy];
629}

References deferredHudName.

Referenced by PlayerEntity::switchHudTo:.

Here is the caller graph for this function:

◆ setHidden:

- (void) setHidden: (BOOL) newValue

Definition at line 578 of file HeadUpDisplay.m.

578 :(BOOL)newValue
579{
580 hudHidden = !!newValue; // ensure YES or NO
581}

References hudHidden.

Referenced by PlayerShipSetProperty(), PlayerShipSetProperty(), PlayerEntity(OOControlsPrivate)::pollApplicationControls, PlayerEntity::setUpShipFromDictionary:, and PlayerEntity::switchHudTo:.

Here is the caller graph for this function:

◆ setHiddenSelector:hidden:

- (void) setHiddenSelector: (NSString*) selectorName
hidden: (BOOL) hide 

Definition at line 596 of file HeadUpDisplay.m.

596 :(NSString*)selectorName hidden:(BOOL)hide
597{
598 if (hide) {
599 [_hiddenSelectors addObject:selectorName];
600 } else {
601 [_hiddenSelectors removeObject:selectorName];
602 }
603}

Referenced by PlayerShipHideHUDSelector(), PlayerShipHideHUDSelector(), PlayerShipShowHUDSelector(), and PlayerShipShowHUDSelector().

Here is the caller graph for this function:

◆ setHudName:

- (void) setHudName: (NSString*) newHudName

Definition at line 513 of file HeadUpDisplay.m.

513 :(NSString*)newHudName
514{
515 if (newHudName != nil) {
516 [hudName release];
517 hudName = [newHudName copy];
518 }
519}

References hudName, and nil.

◆ setLineWidth:

- (void) setLineWidth: (GLfloat) value

Definition at line 4069 of file HeadUpDisplay.m.

4069 :(GLfloat)value
4070{
4071 lineWidth = value;
4072}

References lineWidth.

Referenced by Universe::drawUniverse.

Here is the caller graph for this function:

◆ setMinimalisticScanner:

- (void) setMinimalisticScanner: (BOOL) newValue

Definition at line 1366 of file HeadUpDisplay.m.

1366 :(BOOL)newValue
1367{
1368 minimalistic_scanner = !!newValue;
1369}

References minimalistic_scanner.

Referenced by PlayerShipSetProperty(), and PlayerShipSetProperty().

Here is the caller graph for this function:

◆ setNonlinearScanner:

- (void) setNonlinearScanner: (BOOL) newValue

Definition at line 1383 of file HeadUpDisplay.m.

1383 :(BOOL)newValue
1384{
1385 nonlinear_scanner = !!newValue;
1386}

References nonlinear_scanner.

Referenced by PlayerShipSetProperty(), and PlayerShipSetProperty().

Here is the caller graph for this function:

◆ setOverallAlpha:

- (void) setOverallAlpha: (GLfloat) newAlphaValue

Definition at line 553 of file HeadUpDisplay.m.

553 :(GLfloat)newAlphaValue
554{
555 overallAlpha = OOClamp_0_1_f(newAlphaValue);
556}

References OOClamp_0_1_f(), and overallAlpha.

Referenced by Universe::drawUniverse.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setReticleColorForIndex:toColor:

- (BOOL) setReticleColorForIndex: (NSUInteger) idx
toColor: (OOColor*) newColor 

Definition at line 529 of file HeadUpDisplay.m.

529 :(NSUInteger)idx toColor:(OOColor*)newColor
530{
531 if (newColor && idx < [_reticleColors count]) {
532 [_reticleColors replaceObjectAtIndex:idx withObject:newColor];
533 return YES;
534 }
535 return NO;
536}

References _reticleColors, and count.

Referenced by PlayerShipSetProperty().

Here is the caller graph for this function:

◆ setReticleTargetSensitive:

- (void) setReticleTargetSensitive: (BOOL) newReticleTargetSensitiveValue

Definition at line 563 of file HeadUpDisplay.m.

563 :(BOOL)newReticleTargetSensitiveValue
564{
565 reticleTargetSensitive = !!newReticleTargetSensitiveValue; // ensure YES or NO.
566}

References reticleTargetSensitive.

Referenced by PlayerShipSetProperty(), and PlayerShipSetProperty().

Here is the caller graph for this function:

◆ setScannerUltraZoom:

- (void) setScannerUltraZoom: (BOOL) newValue

Definition at line 1393 of file HeadUpDisplay.m.

1393 :(BOOL)newValue
1394{
1395 scanner_ultra_zoom = !!newValue;
1396}

References scanner_ultra_zoom.

Referenced by PlayerShipSetProperty(), and PlayerShipSetProperty().

Here is the caller graph for this function:

◆ setScannerZoom:

- (void) setScannerZoom: (GLfloat) value

Definition at line 543 of file HeadUpDisplay.m.

543 :(GLfloat)value
544{
545 scanner_zoom = value;
546}

References scanner_zoom.

Referenced by PlayerEntity::doBookkeeping:, PlayerEntity::enterDock:, PlayerEntity::leaveDock:, PlayerEntity::setCommanderDataFromDictionary:, and PlayerEntity::switchHudTo:.

Here is the caller graph for this function:

Member Data Documentation

◆ _compassActive

- (BOOL) _compassActive
private

Definition at line 276 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, isCompassActive, and setCompassActive:.

◆ _crosshairColor

- (OOColor*) _crosshairColor
private

Definition at line 272 of file HeadUpDisplay.h.

Referenced by dealloc, and initWithDictionary:inFile:.

◆ _crosshairOverrides

- (NSDictionary*) _crosshairOverrides
private

Definition at line 271 of file HeadUpDisplay.h.

Referenced by dealloc, initWithDictionary:inFile:, and setCrosshairDefinition:.

◆ _crosshairs

- (OOCrosshairs*) _crosshairs
private

Definition at line 267 of file HeadUpDisplay.h.

Referenced by setCrosshairDefinition:.

◆ _crosshairScale

- (GLfloat) _crosshairScale
private

Definition at line 273 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:.

◆ _crosshairWidth

- (GLfloat) _crosshairWidth
private

Definition at line 274 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, and renderHUD.

◆ _hiddenSelectors

- (NSMutableSet*) _hiddenSelectors
private

Definition at line 264 of file HeadUpDisplay.h.

Referenced by dealloc, and initWithDictionary:inFile:.

◆ _lastOverallAlpha

- (GLfloat) _lastOverallAlpha
private

Definition at line 269 of file HeadUpDisplay.h.

◆ _lastWeaponsOnline

- (BOOL) _lastWeaponsOnline
private

Definition at line 270 of file HeadUpDisplay.h.

◆ _lastWeaponType

- (OOWeaponType) _lastWeaponType
private

Definition at line 268 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:.

◆ _reticleColors

- (NSMutableArray*) _reticleColors
private

◆ allowBigGui

- (BOOL) allowBigGui
private

◆ cloakIndicatorOnStatusLight

- (BOOL) cloakIndicatorOnStatusLight
private

Definition at line 256 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:.

◆ crosshairDefinition

- (NSString *) crosshairDefinition
private

◆ deferredHudName

- (NSString *) deferredHudName
private

Definition at line 631 of file HeadUpDisplay.m.

632{
633 return deferredHudName;
634}

Referenced by dealloc, deferredHudName, Universe::drawUniverse, initWithDictionary:inFile:, and setDeferredHudName:.

◆ dialArray

- (NSMutableArray*) dialArray
private

Definition at line 236 of file HeadUpDisplay.h.

Referenced by dealloc, and initWithDictionary:inFile:.

◆ hudHidden

- (BOOL) hudHidden
private

Definition at line 258 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, isHidden, and setHidden:.

◆ hudName

- (NSString *) hudName
private

◆ hudUpdating

- (BOOL) hudUpdating
private

Definition at line 249 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, isUpdating, and renderHUD.

◆ last_transmitter

- (int) last_transmitter
private

Definition at line 262 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:.

◆ legendArray

- (NSMutableArray*) legendArray
private

Definition at line 235 of file HeadUpDisplay.h.

Referenced by dealloc, and initWithDictionary:inFile:.

◆ lineWidth

- (GLfloat) lineWidth
private

Definition at line 4074 of file HeadUpDisplay.m.

4075{
4076 return lineWidth;
4077}

Referenced by initWithDictionary:inFile:, lineWidth, renderHUD, and setLineWidth:.

◆ mfdArray

- (NSMutableArray*) mfdArray
private

Definition at line 237 of file HeadUpDisplay.h.

Referenced by dealloc, and initWithDictionary:inFile:.

◆ minimalistic_scanner

- (BOOL) minimalistic_scanner
private

◆ nonlinear_scanner

- (BOOL) nonlinear_scanner
private

Definition at line 284 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, nonlinearScanner, and setNonlinearScanner:.

◆ overallAlpha

- (GLfloat) overallAlpha
private

◆ propertiesReticleTargetSensitive

- (NSMutableDictionary *) propertiesReticleTargetSensitive
private

◆ reticleTargetSensitive

- (BOOL) reticleTargetSensitive
private

◆ scanner_ultra_zoom

- (BOOL) scanner_ultra_zoom
private

Definition at line 285 of file HeadUpDisplay.h.

Referenced by initWithDictionary:inFile:, scannerUltraZoom, and setScannerUltraZoom:.

◆ scanner_zoom

- (GLfloat) scanner_zoom
private

Definition at line 240 of file HeadUpDisplay.h.

Referenced by scannerZoom, and setScannerZoom:.

◆ z1


The documentation for this class was generated from the following files: