Oolite
Loading...
Searching...
No Matches
HeadUpDisplay(Private) Category Reference

Instance Methods

(void) - drawCrosshairs
(void) - drawLegends
(void) - drawDials
(void) - drawMFDs
(void) - drawLegend:
(void) - drawHUDItem:
(void) - drawScanner:
(void) - drawScannerZoomIndicator:
(void) - drawCompass:
(void) - drawCompassPlanetBlipAt:Size:Alpha:
(void) - drawCompassStationBlipAt:Size:Alpha:
(void) - drawCompassSunBlipAt:Size:Alpha:
(void) - drawCompassTargetBlipAt:Size:Alpha:
(void) - drawCompassBeaconBlipAt:Size:Alpha:
(void) - drawAegis:
(void) - drawSpeedBar:
(void) - drawRollBar:
(void) - drawPitchBar:
(void) - drawYawBar:
(void) - drawEnergyGauge:
(void) - drawForwardShieldBar:
(void) - drawAftShieldBar:
(void) - drawFuelBar:
(void) - drawWitchspaceDestination:
(void) - drawCabinTempBar:
(void) - drawWeaponTempBar:
(void) - drawAltitudeBar:
(void) - drawMissileDisplay:
(void) - drawTargetReticle:
(void) - drawSecondaryTargetReticle:
(void) - drawWaypoints:
(void) - drawStatusLight:
(void) - drawDirectionCue:
(void) - drawClock:
(void) - drawPrimedEquipmentText:
(void) - drawASCTarget:
(void) - drawWeaponsOfflineText:
(void) - drawMultiFunctionDisplay:withText:asIndex:
(void) - drawFPSInfoCounter:
(void) - drawScoopStatus:
(void) - drawStickSensitivityIndicator:
(void) - drawCustomBar:
(void) - drawCustomText:
(void) - drawCustomIndicator:
(void) - drawCustomLight:
(void) - drawCustomImage:
(void) - drawSurroundInternal:color:
(void) - drawSurround:
(void) - drawGreenSurround:
(void) - drawYellowSurround:
(void) - drawTrumbles:
(NSArray *) - crosshairDefinitionForWeaponType:
(BOOL) - checkPlayerInFlight
(BOOL) - checkPlayerInSystemFlight
(void) - resetGui:withInfo:
(void) - resetGuiPosition:withInfo:

Detailed Description

Definition at line 112 of file HeadUpDisplay.m.

Method Documentation

◆ checkPlayerInFlight

- (BOOL) checkPlayerInFlight

Extends class HeadUpDisplay.

Definition at line 1028 of file HeadUpDisplay.m.

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

References checkPlayerInFlight.

Referenced by checkPlayerInFlight, checkPlayerInSystemFlight, drawPrimedEquipmentText:, and drawScanner:.

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

◆ checkPlayerInSystemFlight

- (BOOL) checkPlayerInSystemFlight

Extends class HeadUpDisplay.

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 HeadUpDisplay::checkPlayerInFlight, checkPlayerInSystemFlight, and OOSunEntity::goneNova.

Referenced by checkPlayerInSystemFlight, drawASCTarget:, drawCompass:, drawDials, and drawPrimedEquipmentText:.

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

◆ crosshairDefinitionForWeaponType:

- (NSArray *) crosshairDefinitionForWeaponType: (OOWeaponType) weapon

Extends class HeadUpDisplay.

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}
return nil
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 drawCrosshairs.

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

◆ drawAegis:

- (void) drawAegis: (NSDictionary *) info

Extends class HeadUpDisplay.

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

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

Extends class HeadUpDisplay.

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]
static void hudDrawSurroundAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz)
#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)

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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
void OODrawStringAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
#define ASCTARGET_DISPLAY_HEIGHT
#define ASCTARGET_DISPLAY_X
#define ASCTARGET_DISPLAY_Y
static void GetRGBAArrayFromInfo(NSDictionary *info, GLfloat ioColor[4])
voidpf void uLong size
Definition ioapi.h:126

References ASCTARGET_DISPLAY_HEIGHT, ASCTARGET_DISPLAY_WIDTH, ASCTARGET_DISPLAY_X, ASCTARGET_DISPLAY_Y, 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

Extends class HeadUpDisplay.

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:

◆ drawClock:

- (void) drawClock: (NSDictionary *) info

Extends class HeadUpDisplay.

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
void OODrawString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
#define CLOCK_DISPLAY_HEIGHT

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

Extends class HeadUpDisplay.

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;
1514 OOGL(GLScaledLineWidth(2.0 * lineWidth));
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, checkPlayerInSystemFlight, COMPASS_CENTRE_X, COMPASS_CENTRE_Y, COMPASS_HALF_SIZE, HeadUpDisplay::drawCompassBeaconBlipAt:Size:Alpha:, HeadUpDisplay::drawCompassPlanetBlipAt:Size:Alpha:, HeadUpDisplay::drawCompassStationBlipAt:Size:Alpha:, HeadUpDisplay::drawCompassSunBlipAt:Size:Alpha:, HeadUpDisplay::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 

Extends class HeadUpDisplay.

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}
OOScalar y
Definition OOVector.h:33
OOScalar z
Definition OOVector.h:34

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

Referenced by drawCompass:.

Here is the caller graph for this function:

◆ drawCompassPlanetBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

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 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 

Extends class HeadUpDisplay.

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 drawCompass:.

Here is the caller graph for this function:

◆ drawCompassSunBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

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 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 

Extends class HeadUpDisplay.

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 drawCompass:.

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

◆ drawCrosshairs

- (void) drawCrosshairs

Extends class HeadUpDisplay.

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) {
840 DESTROY(_crosshairs);
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}
#define DESTROY(x)
OOViewID
Definition OOTypes.h:39

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

Referenced by drawCrosshairs, and HeadUpDisplay::renderHUD.

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

◆ drawCustomBar:

- (void) drawCustomBar: (NSDictionary *) info

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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}
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
NSString *const kOOLogFileNotFound
Definition OOLogging.m:601
void blitCentredToX:Y:Z:alpha:(float x,[Y] float y,[Z] float z,[alpha] float a)
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 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

Extends class HeadUpDisplay.

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}
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
#define SET_COLOR(d)
OOINLINE float OOClamp_n1_1_f(float value) INLINE_CONST_FUNC

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

Extends class HeadUpDisplay.

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)
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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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, checkPlayerInSystemFlight, drawDials, HeadUpDisplay::drawHUDItem:, EXPECT_NOT, and sCurrentDrawItem.

Referenced by drawDials, and HeadUpDisplay::renderHUD.

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

◆ drawDirectionCue:

- (void) drawDirectionCue: (NSDictionary *) info

Extends class HeadUpDisplay.

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}
#define ONE_EIGHTH
@ 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 drawTargetReticle:.

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

◆ drawEnergyGauge:

- (void) drawEnergyGauge: (NSDictionary *) info

Extends class HeadUpDisplay.

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) {
2021 GLColorWithOverallAlpha(green_color, alpha);
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
#define ENERGY_GAUGE_HEIGHT
#define ENERGY_GAUGE_WIDTH
#define ENERGY_GAUGE_CENTRE_Y
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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

Definition at line 3048 of file HeadUpDisplay.m.

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

References HeadUpDisplay::drawSurroundInternal:color:.

Here is the call graph for this function:

◆ drawHUDItem:

- (void) drawHUDItem: (NSDictionary *) info

Extends class HeadUpDisplay.

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 drawDials.

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

◆ drawLegend:

- (void) drawLegend: (NSDictionary *) info

Extends class HeadUpDisplay.

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 drawLegends.

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

◆ drawLegends

- (void) drawLegends

Extends class HeadUpDisplay.

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 HeadUpDisplay::drawLegend:, drawLegends, and sCurrentDrawItem.

Referenced by drawLegends, and HeadUpDisplay::renderHUD.

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

◆ drawMFDs

- (void) drawMFDs

Extends class HeadUpDisplay.

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 drawMFDs, HeadUpDisplay::drawMultiFunctionDisplay:withText:asIndex:, nil, and sCurrentDrawItem.

Referenced by drawMFDs, and HeadUpDisplay::renderHUD.

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

◆ drawMissileDisplay:

- (void) drawMissileDisplay: (NSDictionary *) info

Extends class HeadUpDisplay.

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]) {
2469 GLColorWithOverallAlpha(green_color, alpha);
2470 break;
2472 GLColorWithOverallAlpha(yellow_color, alpha);
2473 break;
2475 GLColorWithOverallAlpha(red_color, alpha);
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();
2484 GLColorWithOverallAlpha(green_color, alpha);
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
OOMissileStatus
@ MISSILE_STATUS_TARGET_LOCKED
@ MISSILE_STATUS_ARMED
@ MISSILE_STATUS_SAFE

References CachedInfo::alpha, HeadUpDisplay::drawIconForEmptyPylonAtX:y:width:height:alpha:, HeadUpDisplay::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 

Extends class HeadUpDisplay.

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:, HeadUpDisplay::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 drawMFDs.

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

◆ drawPitchBar:

- (void) drawPitchBar: (NSDictionary *) info

Extends class HeadUpDisplay.

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:

◆ drawPrimedEquipmentText:

- (void) drawPrimedEquipmentText: (NSDictionary *) info

Extends class HeadUpDisplay.

References checkPlayerInFlight, and checkPlayerInSystemFlight.

Here is the call graph for this function:

◆ drawRollBar:

- (void) drawRollBar: (NSDictionary *) info

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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;
1100 if (scanner_ultra_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));
1127 drawScannerGrid(x, y, z1, siz, [UNIVERSE viewDirection], lineWidth, zoom, nonlinear_scanner, minimalistic_scanner);
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]
static void drawScannerGrid(GLfloat x, GLfloat y, GLfloat z, NSSize siz, int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
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 * 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, 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(), HeadUpDisplay::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:

◆ drawScannerZoomIndicator:

- (void) drawScannerZoomIndicator: (NSDictionary *) info

Extends class HeadUpDisplay.

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;
1437 if (scanner_ultra_zoom)
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
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

Extends class HeadUpDisplay.

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
2933 GLColorWithOverallAlpha(s1c, overallAlpha);
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
2939 GLColorWithOverallAlpha(s2c, overallAlpha);
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
2949 GLColorWithOverallAlpha(s3c, overallAlpha);
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

Extends class HeadUpDisplay.

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
static void hudDrawReticleOnTarget(Entity *target, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive, BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
#define PLAYER_TARGET_MEMORY_SIZE
NSMutableArray * targetMemory()

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

Referenced by drawTargetReticle:.

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

◆ drawSpeedBar:

- (void) drawSpeedBar: (NSDictionary *) info

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

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

Extends class HeadUpDisplay.

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
2984 GLColorWithOverallAlpha(black_color, alpha / 4);
2985 GLDrawFilledOval(x, y, z1, siz, 10);
2986
2987 GLColorWithOverallAlpha((div < 1.0 || mouse) ? lightgray_color : green_color, alpha);
2988 OOGL(GLScaledLineWidth(_crosshairWidth * lineWidth));
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
2996 GLColorWithOverallAlpha(lightgray_color, alpha);
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}
static const GLfloat lightgray_color[4]
static const GLfloat black_color[4]

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

Extends class HeadUpDisplay.

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:, HeadUpDisplay::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) color[4] 

Extends class HeadUpDisplay.

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 drawGreenSurround:, drawMultiFunctionDisplay:withText:asIndex:, drawSurround:, and drawYellowSurround:.

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

◆ drawTargetReticle:

- (void) drawTargetReticle: (NSDictionary *) info

Extends class HeadUpDisplay.

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) {
2494 hudDrawReticleOnTarget([PLAYER primaryTarget], PLAYER, z1, alpha, reticleTargetSensitive, propertiesReticleTargetSensitive, NO, YES, info, _reticleColors);
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}

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

Here is the call graph for this function:

◆ drawTrumbles:

- (void) drawTrumbles: (NSDictionary *) info

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

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

Extends class HeadUpDisplay.

Definition at line 3053 of file HeadUpDisplay.m.

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

References HeadUpDisplay::drawSurroundInternal:color:.

Here is the call graph for this function:

◆ resetGui:withInfo:

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

Extends class HeadUpDisplay.

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, HeadUpDisplay::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 HeadUpDisplay::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 

Extends class HeadUpDisplay.

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 resetGui:withInfo:.

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

The documentation for this category was generated from the following file: