Oolite 1.91.0.7645-241119-222d325
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 118 of file HeadUpDisplay.m.

Method Documentation

◆ checkPlayerInFlight

- (BOOL) checkPlayerInFlight

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

1151{
1152 return [PLAYER isInSpace] && [PLAYER status] != STATUS_DOCKING;
1153}

◆ checkPlayerInSystemFlight

- (BOOL) checkPlayerInSystemFlight

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

1157{
1158 OOSunEntity *the_sun = [UNIVERSE sun];
1159 OOPlanetEntity *the_planet = [UNIVERSE planet];
1160
1161 return [self checkPlayerInFlight] // be in the right mode
1162 && the_sun && the_planet // and be in a system
1163 && ![the_sun goneNova];
1164}

◆ crosshairDefinitionForWeaponType:

- (NSArray *) crosshairDefinitionForWeaponType: (OOWeaponType) weapon

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

990 :(OOWeaponType)weapon
991{
992 NSString *weaponName = nil;
993 NSString *weaponName2 = nil;
994 static NSDictionary *crosshairDefs = nil;
995 NSArray *result = nil;
996
997 /* Search order:
998 (hud.plist).crosshairs.WEAPON_NAME
999 (hud.plist).crosshairs.OTHER
1000 (crosshairs.plist).WEAPON_NAME
1001 (crosshairs.plist).OTHER
1002 */
1003
1004 weaponName = OOStringFromWeaponType(weapon);
1005 weaponName2 = [weaponName substringFromIndex:3]; // strip "EQ_"
1006 result = [_crosshairOverrides oo_arrayForKey:weaponName];
1007 if (result == nil)
1008 {
1009 result = [_crosshairOverrides oo_arrayForKey:weaponName2];
1010 }
1011 if (result == nil) result = [_crosshairOverrides oo_arrayForKey:@"OTHER"];
1012 if (result == nil)
1013 {
1014 if (crosshairDefs == nil)
1015 {
1016 crosshairDefs = [ResourceManager dictionaryFromFilesNamed:@"crosshairs.plist"
1017 inFolder:@"Config"
1018 andMerge:YES];
1019 [crosshairDefs retain];
1020 }
1021
1022 result = [crosshairDefs oo_arrayForKey:weaponName];
1023 if (result == nil)
1024 {
1025 result = [crosshairDefs oo_arrayForKey:weaponName2];
1026 }
1027 if (result == nil) result = [crosshairDefs oo_arrayForKey:@"OTHER"];
1028 }
1029
1030 return result;
1031}
return nil
OOEquipmentType * OOWeaponType
Definition ShipEntity.h:168
NSString * OOStringFromWeaponType(OOWeaponType weapon) CONST_FUNC
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

◆ drawAegis:

- (void) drawAegis: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1785 :(NSDictionary *)info
1786{
1787 if (([UNIVERSE viewDirection] == VIEW_GUI_DISPLAY)||([UNIVERSE sun] == nil)||([PLAYER checkForAegis] != AEGIS_IN_DOCKING_RANGE))
1788 return; // don't draw
1789
1790 int x, y;
1791 NSSize siz;
1792 GLfloat alpha = 0.5f * overallAlpha;
1793 struct CachedInfo cached;
1794
1795 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1796
1797 x = useDefined(cached.x, AEGIS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1798 y = useDefined(cached.y, AEGIS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1799 siz.width = useDefined(cached.width, AEGIS_WIDTH);
1800 siz.height = useDefined(cached.height, AEGIS_HEIGHT);
1801 alpha *= cached.alpha;
1802
1803 // draw the aegis indicator
1804 //
1805 GLfloat w = siz.width / 16.0;
1806 GLfloat h = siz.height / 16.0;
1807
1808 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 };
1809
1810#if 1
1811 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1812 OOGLBEGIN(GL_QUAD_STRIP);
1813 int i;
1814 for (i = 0; i < 32; i += 2)
1815 {
1816 glVertex3f(x + w * strip[i], y - h * strip[i + 1], z1);
1817 }
1818 OOGLEND();
1819#else
1821 OOGLTranslateModelView(make_vector(x, y, z1));
1822 OOGLScaleModelView(make_vector(w, -h, 1.0f));
1823
1824 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1825 OOGL(glVertexPointer(2, GL_FLOAT, 0, strip));
1826 OOGL(glEnableClientState(GL_VERTEX_ARRAY));
1827 OOGL(glDisableClientState(GL_COLOR_ARRAY));
1828
1829 OOGL(glDrawArrays(GL_QUAD_STRIP, 0, sizeof strip / sizeof *strip / 2));
1830 OOGL(glDisableClientState(GL_VERTEX_ARRAY));
1831
1833#endif
1834}
#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:253
#define OOGL(statement)
Definition OOOpenGL.h:251
#define OOGLEND
Definition OOOpenGL.h:254
float y
float x
@ AEGIS_IN_DOCKING_RANGE
Definition OOTypes.h:64
#define PLAYER
#define UNIVERSE
Definition Universe.h:833

References OOGL.

◆ drawAftShieldBar:

- (void) drawAftShieldBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2278 :(NSDictionary *)info
2279{
2280 int x, y;
2281 NSSize siz;
2282 BOOL draw_surround;
2283 GLfloat alpha = overallAlpha;
2284 GLfloat shield = [PLAYER dialAftShield];
2285 struct CachedInfo cached;
2286
2287 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2288
2289 x = useDefined(cached.x, AFT_SHIELD_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2290 y = useDefined(cached.y, AFT_SHIELD_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2292 siz.height = useDefined(cached.height, AFT_SHIELD_BAR_HEIGHT);
2293 alpha *= cached.alpha;
2294 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:AFT_SHIELD_BAR_DRAW_SURROUND];
2295
2296 if (draw_surround)
2297 {
2298 // draw forward_shield surround
2300 hudDrawSurroundAt(x, y, z1, siz);
2301 }
2302 // draw forward_shield bar
2303 if (shield < .25)
2304 {
2306 }
2307 else if (shield < .80)
2308 {
2310 }
2311 else
2312 {
2314 }
2315 hudDrawBarAt(x, y, z1, siz, shield);
2316}
#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)

◆ drawAltitudeBar:

- (void) drawAltitudeBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2488 :(NSDictionary *)info
2489{
2490 int x, y;
2491 NSSize siz;
2492 BOOL draw_surround;
2493 GLfloat alt = [PLAYER dialAltitude];
2494 GLfloat alpha = overallAlpha;
2495 struct CachedInfo cached;
2496
2497 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2498
2499 x = useDefined(cached.x, ALTITUDE_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2500 y = useDefined(cached.y, ALTITUDE_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2502 siz.height = useDefined(cached.height, ALTITUDE_BAR_HEIGHT);
2503 alpha *= cached.alpha;
2504 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2505
2506 if (draw_surround)
2507 {
2509 hudDrawSurroundAt(x, y, z1, siz);
2510 }
2511
2512 int flash = (int)([UNIVERSE getTime] * 4);
2513 flash &= 1;
2514
2515 // draw altitude bar (evaluating the least amount of ifs per go)
2516 if (alt < .25)
2517 {
2518 if (alt < .10 && flash)
2520 else
2522 }
2523 else
2524 {
2525 if (alt < .75)
2527 else
2529 }
2530
2531 hudDrawBarAt(x, y, z1, siz, alt);
2532
2533}
#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

◆ drawASCTarget:

- (void) drawASCTarget: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3011 :(NSDictionary *)info
3012{
3013 if (!([self checkPlayerInSystemFlight] && [PLAYER status] != STATUS_LAUNCHING)) // normal system
3014 {
3015 // Can't have compass target when docked, etc. (matches blip condition)
3016 return;
3017 }
3018
3019 GLfloat itemColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
3020 struct CachedInfo cached;
3021
3022 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3023
3024 NSInteger x = useDefined(cached.x, ASCTARGET_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
3025 NSInteger y = useDefined(cached.y, ASCTARGET_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
3026
3027 NSSize size =
3028 {
3029 .width = useDefined(cached.width, ASCTARGET_DISPLAY_WIDTH),
3030 .height = useDefined(cached.height, ASCTARGET_DISPLAY_HEIGHT)
3031 };
3032
3033 GetRGBAArrayFromInfo(info, itemColor);
3034 itemColor[3] *= overallAlpha;
3035
3036 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
3037 if ([info oo_intForKey:@"align"] == 1)
3038 {
3039 OODrawStringAligned([PLAYER compassTargetLabel], x, y, z1, size,YES);
3040 }
3041 else
3042 {
3043 OODrawStringAligned([PLAYER compassTargetLabel], x, y, z1, size,NO);
3044 }
3045
3046}
#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:134

References kDefaultMineIconKey, kDefaultMissileIconKey, and nil.

◆ drawCabinTempBar:

- (void) drawCabinTempBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2406 :(NSDictionary *)info
2407{
2408 int x, y;
2409 NSSize siz;
2410 BOOL draw_surround;
2411 GLfloat temp = [PLAYER hullHeatLevel];
2412 GLfloat alpha = overallAlpha;
2413 struct CachedInfo cached;
2414
2415 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2416
2417 x = useDefined(cached.x, CABIN_TEMP_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2418 y = useDefined(cached.y, CABIN_TEMP_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2420 siz.height = useDefined(cached.height, CABIN_TEMP_BAR_HEIGHT);
2421 alpha *= cached.alpha;
2422 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2423
2424 if (draw_surround)
2425 {
2427 hudDrawSurroundAt(x, y, z1, siz);
2428 }
2429
2430 int flash = (int)([UNIVERSE getTime] * 4);
2431 flash &= 1;
2432 // what color are we?
2433 if (temp > .80)
2434 {
2435 if (temp > .90 && flash)
2437 else
2439 }
2440 else
2441 {
2442 if (temp > .25)
2444 else
2446 }
2447
2448
2449 hudDrawBarAt(x, y, z1, siz, temp);
2450}
#define CABIN_TEMP_BAR_HEIGHT
#define CABIN_TEMP_BAR_CENTRE_Y
#define CABIN_TEMP_BAR_WIDTH
#define CABIN_TEMP_BAR_CENTRE_X

◆ drawClock:

- (void) drawClock: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2929 :(NSDictionary *)info
2930{
2931 int x, y;
2932 NSSize siz;
2933 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2934 struct CachedInfo cached;
2935
2936 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2937
2938 x = useDefined(cached.x, CLOCK_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2939 y = useDefined(cached.y, CLOCK_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2941 siz.height = useDefined(cached.height, CLOCK_DISPLAY_HEIGHT);
2942
2943 GetRGBAArrayFromInfo(info, itemColor);
2944 itemColor[3] *= overallAlpha;
2945
2946 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2947 OODrawString([PLAYER dial_clock], x, y, z1, siz);
2948}
#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

◆ drawCompass:

- (void) drawCompass: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1167 of file HeadUpDisplay.m.

1589 :(NSDictionary *)info
1590{
1591 int x, y;
1592 NSSize siz;
1593 GLfloat alpha;
1594 GLfloat compass_color[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
1595 struct CachedInfo cached;
1596
1597 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1598
1599 x = useDefined(cached.x, COMPASS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1600 y = useDefined(cached.y, COMPASS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1601 siz.width = useDefined(cached.width, COMPASS_HALF_SIZE);
1602 siz.height = useDefined(cached.height, COMPASS_HALF_SIZE);
1603
1604 GetRGBAArrayFromInfo(info, compass_color);
1605 compass_color[3] *= overallAlpha;
1606 alpha = compass_color[3];
1607
1608 // draw the compass
1609 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1610
1611 GLfloat h1 = siz.height * 0.125;
1612 GLfloat h3 = siz.height * 0.375;
1613 GLfloat w1 = siz.width * 0.125;
1614 GLfloat w3 = siz.width * 0.375;
1615 OOGL(GLScaledLineWidth(2.0 * lineWidth)); // thicker
1616 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], alpha));
1617 GLDrawOval(x, y, z1, siz, 12);
1618 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], 0.5f * alpha));
1619 OOGLBEGIN(GL_LINES);
1620 glVertex3f(x - w1, y, z1); glVertex3f(x - w3, y, z1);
1621 glVertex3f(x + w1, y, z1); glVertex3f(x + w3, y, z1);
1622 glVertex3f(x, y - h1, z1); glVertex3f(x, y - h3, z1);
1623 glVertex3f(x, y + h1, z1); glVertex3f(x, y + h3, z1);
1624 OOGLEND();
1625 OOGL(GLScaledLineWidth(lineWidth)); // thinner
1626
1627 if ([self checkPlayerInSystemFlight] && [PLAYER status] != STATUS_LAUNCHING) // normal system
1628 {
1629 Entity *reference = [PLAYER compassTarget];
1630
1631 // translate and rotate the view
1632
1633 Vector relativePosition = [PLAYER vectorTo:reference];
1634 relativePosition = OOVectorMultiplyMatrix(relativePosition, rotMatrix);
1635 relativePosition = vector_normal_or_fallback(relativePosition, kBasisZVector);
1636
1637 relativePosition.x *= siz.width * 0.4;
1638 relativePosition.y *= siz.height * 0.4;
1639 relativePosition.x += x;
1640 relativePosition.y += y;
1641
1642 siz.width *= 0.2;
1643 siz.height *= 0.2;
1644 OOGL(GLScaledLineWidth(2.0*lineWidth));
1645 switch ([PLAYER compassMode])
1646 {
1647 case COMPASS_MODE_INACTIVE:
1648 break;
1649
1650 case COMPASS_MODE_BASIC:
1651 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
1652 [self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1653 else
1654 [self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1655 break;
1656
1657 case COMPASS_MODE_PLANET:
1658 [self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1659 break;
1660
1661 case COMPASS_MODE_STATION:
1662 [self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1663 break;
1664
1665 case COMPASS_MODE_SUN:
1666 [self drawCompassSunBlipAt:relativePosition Size:siz Alpha:alpha];
1667 break;
1668
1669 case COMPASS_MODE_TARGET:
1670 [self drawCompassTargetBlipAt:relativePosition Size:siz Alpha:alpha];
1671 break;
1672
1673 case COMPASS_MODE_BEACONS:
1674 [self drawCompassBeaconBlipAt:relativePosition Size:siz Alpha:alpha];
1675 Entity <OOBeaconEntity> *beacon = [PLAYER nextBeacon];
1676 [[beacon beaconDrawable] oo_drawHUDBeaconIconAt:NSMakePoint(x, y) size:siz alpha:alpha z:z1];
1677 break;
1678 }
1679 OOGL(GLScaledLineWidth(lineWidth)); // reset
1680
1681 _compassUpdated = YES;
1682 _compassActive = YES;
1683 }
1684}
#define COMPASS_CENTRE_Y
#define COMPASS_CENTRE_X
#define COMPASS_HALF_SIZE
static BOOL _compassUpdated
Vector OOVectorMultiplyMatrix(Vector v, OOMatrix m)
Definition OOMatrix.m:129
void GLScaledLineWidth(GLfloat width)
Definition OOOpenGL.m:218
void GLDrawOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
Definition OOOpenGL.m:155
const Vector kBasisZVector
Definition OOVector.m:31

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

◆ drawCompassBeaconBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1756 :(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1757{
1758 SetCompassBlipColor(relativePosition.z, alpha);
1759
1760 OOGLBEGIN(GL_LINES);
1761 /* glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1762 glVertex3f(relativePosition.x, relativePosition.y + 0.5 * siz.height, z1);
1763
1764 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1765 glVertex3f(relativePosition.x, relativePosition.y + 0.5 * siz.height, z1);
1766
1767 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1768 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1); */
1769 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1770 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1771
1772 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1773 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1774
1775 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1776 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1777
1778 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1779 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1780
1781 OOGLEND();
1782}

◆ drawCompassPlanetBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1700 :(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1701{
1702 if (relativePosition.z >= 0)
1703 {
1704 OOGL(glColor4f(0.0,1.0,0.0,0.75 * alpha));
1705 GLDrawFilledOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1706 OOGL(glColor4f(0.0,1.0,0.0,alpha));
1707 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1708 }
1709 else
1710 {
1711 OOGL(glColor4f(1.0,0.0,0.0,alpha));
1712 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1713 }
1714}

◆ drawCompassStationBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1717 :(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1718{
1719 SetCompassBlipColor(relativePosition.z, alpha);
1720
1721 OOGLBEGIN(GL_LINE_LOOP);
1722 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1723 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y - 0.5 * siz.height, z1);
1724 glVertex3f(relativePosition.x + 0.5 * siz.width, relativePosition.y + 0.5 * siz.height, z1);
1725 glVertex3f(relativePosition.x - 0.5 * siz.width, relativePosition.y + 0.5 * siz.height, z1);
1726 OOGLEND();
1727}

◆ drawCompassSunBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1730 :(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1731{
1732 OOGL(glColor4f(1.0, 1.0, 0.0, 0.75 * alpha));
1733 GLDrawFilledOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1734
1735 SetCompassBlipColor(relativePosition.z, alpha);
1736
1737 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1738}
void GLDrawFilledOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
Definition OOOpenGL.m:165

◆ drawCompassTargetBlipAt:Size:Alpha:

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

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1741 :(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1742{
1743 SetCompassBlipColor(relativePosition.z, alpha);
1744
1745 OOGLBEGIN(GL_LINES);
1746 glVertex3f(relativePosition.x - siz.width, relativePosition.y, z1);
1747 glVertex3f(relativePosition.x + siz.width, relativePosition.y, z1);
1748 glVertex3f(relativePosition.x, relativePosition.y - siz.height, z1);
1749 glVertex3f(relativePosition.x, relativePosition.y + siz.height, z1);
1750 OOGLEND();
1751
1752 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1753}

◆ drawCrosshairs

- (void) drawCrosshairs

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

919{
920 OOViewID viewID = [UNIVERSE viewDirection];
921 OOWeaponType weapon = [PLAYER currentWeapon];
922 BOOL weaponsOnline = [PLAYER weaponsOnline];
923 NSArray *points = nil;
924
925 if (viewID == VIEW_CUSTOM ||
926 overallAlpha == 0.0f ||
927 !([PLAYER status] == STATUS_IN_FLIGHT || [PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
928 [UNIVERSE displayGUI]
929 )
930 {
931 // Don't draw crosshairs
932 return;
933 }
934
935 if (weapon != _lastWeaponType || overallAlpha != _lastOverallAlpha || weaponsOnline != _lastWeaponsOnline)
936 {
937 DESTROY(_crosshairs);
938 }
939
940 if (_crosshairs == nil)
941 {
942 GLfloat useAlpha = weaponsOnline ? overallAlpha : overallAlpha * 0.5f;
943
944 // Make new crosshairs object
945 points = [self crosshairDefinitionForWeaponType:weapon];
946
947 _crosshairs = [[OOCrosshairs alloc] initWithPoints:points
948 scale:_crosshairScale
949 color:_crosshairColor
950 overallAlpha:useAlpha];
951 _lastWeaponType = weapon;
952 _lastOverallAlpha = useAlpha;
953 _lastWeaponsOnline = weaponsOnline;
954 }
955
956 [_crosshairs render];
957}
#define DESTROY(x)
Definition OOCocoa.h:77
OOViewID
Definition OOTypes.h:43

◆ drawCustomBar:

- (void) drawCustomBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1837 :(NSDictionary *)info
1838{
1839 int x, y;
1840 NSSize siz;
1841 BOOL draw_surround;
1842 GLfloat alpha = overallAlpha;
1843 GLfloat ds = OOClamp_0_1_f([PLAYER dialCustomFloat:[info oo_stringForKey:CUSTOM_DIAL_KEY]]);
1844 struct CachedInfo cached;
1845
1846 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1847
1848 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1849 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1850 siz.width = useDefined(cached.width, 50);
1851 siz.height = useDefined(cached.height, 8);
1852 alpha *= cached.alpha;
1853
1854 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1855
1857 if (draw_surround)
1858 {
1859 // draw custom surround
1860 hudDrawSurroundAt(x, y, z1, siz);
1861 }
1862 // draw custom bar
1863 if (ds > .75)
1864 {
1866 }
1867 else if (ds > .25)
1868 {
1870 }
1871 else
1872 {
1874 }
1875
1876 hudDrawBarAt(x, y, z1, siz, ds);
1877}
#define CUSTOM_DIAL_KEY

◆ drawCustomImage:

- (void) drawCustomImage: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1977 :(NSDictionary *)info
1978{
1979 int x, y;
1980 GLfloat alpha = overallAlpha;
1981
1982 struct CachedInfo cached;
1983
1984 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1985
1986 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1987 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1988 alpha *= cached.alpha;
1989
1990 NSString *textureFile = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1991 if (textureFile == nil || [textureFile length] == 0) {
1992 return;
1993 }
1994
1995 OOTexture *texture = [OOTexture textureWithName:textureFile
1996 inFolder:@"Images"
1997 options:kOOTextureDefaultOptions | kOOTextureNoShrink
1998 anisotropy:kOOTextureDefaultAnisotropy
1999 lodBias:kOOTextureDefaultLODBias];
2000 if (texture == nil)
2001 {
2002 OOLogERR(kOOLogFileNotFound, @"HeadUpDisplay couldn't get an image texture name for %@", textureFile);
2003 return;
2004 }
2005
2006 NSSize imageSize = [texture dimensions];
2007 imageSize.width = useDefined(cached.width, imageSize.width);
2008 imageSize.height = useDefined(cached.height, imageSize.height);
2009
2010 /* There's possibly some optimisation which could be done by
2011 * caching the sprite, but regenerating it each frame doesn't
2012 * appear to take any significant amount of time compared with the
2013 * time taken to actually render it and the texture will be
2014 * returned from the cache anyway. - CIM */
2015 OOTextureSprite *sprite = [[OOTextureSprite alloc] initWithTexture:texture size:imageSize];
2016
2017 [sprite blitCentredToX:x Y:y Z:z1 alpha:alpha];
2018 [sprite release];
2019
2020}
#define OOLogERR(class, format,...)
Definition OOLogging.h:112
NSString *const kOOLogFileNotFound
Definition OOLogging.m:652
void blitCentredToX:Y:Z:alpha:(float x,[Y] float y,[Z] float z,[alpha] float a)
NSSize dimensions()
Definition OOTexture.m:306
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)
Definition OOTexture.m:134

◆ drawCustomIndicator:

- (void) drawCustomIndicator: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1911 :(NSDictionary *)info
1912{
1913 int x, y;
1914 NSSize siz;
1915 BOOL draw_surround;
1916 GLfloat alpha = overallAlpha;
1917 GLfloat iv = OOClamp_n1_1_f([PLAYER dialCustomFloat:[info oo_stringForKey:CUSTOM_DIAL_KEY]]);
1918
1919 struct CachedInfo cached;
1920
1921 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1922
1923 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1924 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1925 siz.width = useDefined(cached.width, 50);
1926 siz.height = useDefined(cached.height, 8);
1927 alpha *= cached.alpha;
1928 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1929
1930 if (draw_surround)
1931 {
1932 // draw custom surround
1934 hudDrawSurroundAt(x, y, z1, siz);
1935 }
1936 // draw custom indicator
1938 hudDrawIndicatorAt(x, y, z1, siz, iv);
1939}
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
#define SET_COLOR(d)

◆ drawCustomLight:

- (void) drawCustomLight: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1942 :(NSDictionary *)info
1943{
1944 int x, y;
1945 NSSize siz;
1946 GLfloat alpha = overallAlpha;
1947
1948 struct CachedInfo cached;
1949
1950 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1951
1952 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1953 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1954 siz.width = useDefined(cached.width, 8);
1955 siz.height = useDefined(cached.height, 8);
1956 alpha *= cached.alpha;
1957
1958 GLfloat light_color[4] = { 0.25, 0.25, 0.25, 0.0};
1959
1960 OOColor *color = [PLAYER dialCustomColor:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1961 [color getRed:&light_color[0]
1962 green:&light_color[1]
1963 blue:&light_color[2]
1964 alpha:&light_color[3]];
1965
1966 GLColorWithOverallAlpha(light_color, alpha);
1967 OOGLBEGIN(GL_POLYGON);
1968 hudDrawStatusIconAt(x, y, z1, siz);
1969 OOGLEND();
1970 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
1971 OOGLBEGIN(GL_LINE_LOOP);
1972 hudDrawStatusIconAt(x, y, z1, siz);
1973 OOGLEND();
1974}
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:368

◆ drawCustomText:

- (void) drawCustomText: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

1880 :(NSDictionary *)info
1881{
1882 int x, y;
1883 NSSize size;
1884 GLfloat alpha = overallAlpha;
1885 NSString *text = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1886 struct CachedInfo cached;
1887
1888 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1889
1890 x = useDefined(cached.x, 0) + [[UNIVERSE gameView] x_offset] * cached.x0;
1891 y = useDefined(cached.y, 0) + [[UNIVERSE gameView] y_offset] * cached.y0;
1892 alpha *= cached.alpha;
1893
1895
1896 size.width = useDefined(cached.width, 10.0f);
1897 size.height = useDefined(cached.height, 10.0f);
1898
1899 if ([info oo_intForKey:@"align"] == 1)
1900 {
1901 OODrawStringAligned(text, x, y, z1, size, YES);
1902 }
1903 else
1904 {
1905 OODrawStringAligned(text, x, y, z1, size, NO);
1906 }
1907
1908}

◆ drawDials

- (void) drawDials

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

879{
880 z1 = [[UNIVERSE gameView] display_z];
881 // reset drawScanner flag.
882 _compassUpdated = NO;
883
884 // tight loop, we assume dialArray doesn't change in mid-draw.
885 NSUInteger i, nDials = [dialArray count];
886 for (i = 0; i < nDials; i++)
887 {
888 sCurrentDrawItem = [dialArray oo_arrayAtIndex:i];
889 [self drawHUDItem:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
890 }
891
892 if (EXPECT_NOT(!_compassUpdated && _compassActive && [self checkPlayerInSystemFlight])) // compass gone / broken / disabled ?
893 {
894 // trigger the targetChanged event with whom == null
895 _compassActive = NO;
896 [PLAYER doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:[NSNull null], OOStringFromCompassMode([PLAYER compassMode]), nil]];
897 }
898
899}
static NSArray * sCurrentDrawItem
#define EXPECT_NOT(x)

◆ drawDirectionCue:

- (void) drawDirectionCue: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2841 :(NSDictionary *)info
2842{
2843 GLfloat alpha = overallAlpha;
2844 struct CachedInfo cached;
2845
2846 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2847
2848 alpha *= cached.alpha;
2849
2850 if ([UNIVERSE displayGUI]) return;
2851
2852 Entity *target = [PLAYER primaryTarget];
2853 if (target == nil) return;
2854
2855 // draw the direction cue
2856 OOMatrix rotMatrix;
2857
2858 rotMatrix = [PLAYER rotationMatrix];
2859
2860 if ([UNIVERSE viewDirection] != VIEW_GUI_DISPLAY)
2861 {
2862 const GLfloat innerSize = CROSSHAIR_SIZE;
2863 const GLfloat width = CROSSHAIR_SIZE * ONE_EIGHTH;
2864 const GLfloat outerSize = CROSSHAIR_SIZE * (1.0f + ONE_EIGHTH + ONE_EIGHTH);
2865 const float visMin = 0.994521895368273f; // cos(6 degrees)
2866 const float visMax = 0.984807753012208f; // cos(10 degrees)
2867
2868 // Transform the view
2869 Vector rpn = [PLAYER vectorTo:target];
2870 rpn = OOVectorMultiplyMatrix(rpn, rotMatrix);
2871 Vector drawPos = rpn;
2872 Vector forward = kZeroVector;
2873
2874 switch ([UNIVERSE viewDirection])
2875 {
2876 case VIEW_FORWARD:
2877 forward = kBasisZVector;
2878 break;
2879 case VIEW_AFT:
2880 drawPos.x = - drawPos.x;
2881 forward = vector_flip(kBasisZVector);
2882 break;
2883 case VIEW_PORT:
2884 drawPos.x = drawPos.z;
2885 forward = vector_flip(kBasisXVector);
2886 break;
2887 case VIEW_STARBOARD:
2888 drawPos.x = -drawPos.z;
2889 forward = kBasisXVector;
2890 break;
2891 case VIEW_CUSTOM:
2892 return;
2893
2894 default:
2895 break;
2896 }
2897
2898 float cosAngle = dot_product(vector_normal(rpn), forward);
2899 float visibility = 1.0f - ((visMax - cosAngle) * (1.0f / (visMax - visMin)));
2900 alpha *= OOClamp_0_1_f(visibility);
2901
2902 if (alpha > 0.0f)
2903 {
2904 NSUInteger cueColorIndex = [target isWormhole] ? OO_RETICLE_COLOR_WORMHOLE : OO_RETICLE_COLOR_TARGET;
2905 OOColor *directionCueColor = [_reticleColors objectAtIndex:cueColorIndex];
2906 GLfloat clearColorArray[4] = {[directionCueColor redComponent],
2907 [directionCueColor greenComponent],
2908 [directionCueColor blueComponent],
2909 0.0f};
2910 GLfloat directionCueColorArray[4] = {[directionCueColor redComponent],
2911 [directionCueColor greenComponent],
2912 [directionCueColor blueComponent],
2913 [directionCueColor alphaComponent]};
2914 drawPos.z = 0.0f; // flatten vector
2915 drawPos = vector_normal(drawPos);
2916 OOGLBEGIN(GL_LINE_STRIP);
2917 glColor4fv(clearColorArray);
2918 glVertex3f(drawPos.x * innerSize - drawPos.y * width, drawPos.y * innerSize + drawPos.x * width, z1);
2919 GLColorWithOverallAlpha(directionCueColorArray, alpha);
2920 glVertex3f(drawPos.x * outerSize, drawPos.y * outerSize, z1);
2921 glColor4fv(clearColorArray);
2922 glVertex3f(drawPos.x * innerSize + drawPos.y * width, drawPos.y * innerSize - drawPos.x * width, z1);
2923 OOGLEND();
2924 }
2925 }
2926}
#define ONE_EIGHTH
@ OO_RETICLE_COLOR_TARGET
@ OO_RETICLE_COLOR_WORMHOLE
const Vector kZeroVector
Definition OOVector.m:28
const Vector kBasisXVector
Definition OOVector.m:29
#define CROSSHAIR_SIZE
Definition Universe.h:60
unsigned isWormhole
Definition Entity.h:94
float alphaComponent()
Definition OOColor.m:486
float blueComponent()
Definition OOColor.m:362
float redComponent()
Definition OOColor.m:350
float greenComponent()
Definition OOColor.m:356

◆ drawEnergyGauge:

- (void) drawEnergyGauge: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2155 :(NSDictionary *)info
2156{
2157 int x, y;
2158 unsigned i;
2159 NSSize siz;
2160 BOOL drawSurround, labelled, energyCritical = NO;
2161 GLfloat alpha = overallAlpha;
2162 GLfloat bankHeight, bankY;
2163 PlayerEntity *player = PLAYER;
2164
2165 unsigned n_bars = [player dialMaxEnergy]/64.0;
2166 n_bars = [info oo_unsignedIntForKey:N_BARS_KEY defaultValue:n_bars];
2167 if (n_bars < 1)
2168 {
2169 n_bars = 1;
2170 }
2171 GLfloat energy = [player dialEnergy] * n_bars;
2172 struct CachedInfo cached;
2173
2174 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2175
2176 x = useDefined(cached.x, ENERGY_GAUGE_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2177 y = useDefined(cached.y, ENERGY_GAUGE_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2179 siz.height = useDefined(cached.height, ENERGY_GAUGE_HEIGHT);
2180 alpha *= cached.alpha;
2181 drawSurround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ENERGY_GAUGE_DRAW_SURROUND];
2182 labelled = [info oo_boolForKey:LABELLED_KEY defaultValue:YES];
2183 if (n_bars > 8) labelled = NO;
2184
2185 if (drawSurround)
2186 {
2187 // draw energy surround
2189 hudDrawSurroundAt(x, y, z1, siz);
2190 }
2191
2192 bankHeight = siz.height / n_bars;
2193 // draw energy banks
2194 NSSize barSize = NSMakeSize(siz.width, bankHeight - 2.0); // leave a gap between bars
2195 GLfloat midBank = bankHeight / 2.0f;
2196 bankY = y - (n_bars - 1) * midBank - 1.0;
2197
2198 // avoid constant colour switching...
2199 if (labelled)
2200 {
2201 GLColorWithOverallAlpha(green_color, alpha);
2202 GLfloat labelStartX = x + 0.5f * barSize.width + 3.0f;
2203 NSSize labelSize = NSMakeSize(9.0, (bankHeight < 18.0)? bankHeight : 18.0);
2204 for (i = 0; i < n_bars; i++)
2205 {
2206 OODrawString([NSString stringWithFormat:@"E%x", n_bars - i], labelStartX, bankY - midBank, z1, labelSize);
2207 bankY += bankHeight;
2208 }
2209 }
2210
2211 if (energyCritical)
2212 {
2214 }
2215 else
2216 {
2218 }
2219 bankY = y - (n_bars - 1) * midBank;
2220 for (i = 0; i < n_bars; i++)
2221 {
2222 if (energy > 1.0)
2223 {
2224 hudDrawBarAt(x, bankY, z1, barSize, 1.0);
2225 }
2226 else if (energy > 0.0)
2227 {
2228 hudDrawBarAt(x, bankY, z1, barSize, energy);
2229 }
2230
2231 energy -= 1.0;
2232 bankY += bankHeight;
2233 }
2234}
#define ENERGY_GAUGE_CENTRE_X
#define ENERGY_GAUGE_HEIGHT
#define ENERGY_GAUGE_WIDTH
#define ENERGY_GAUGE_CENTRE_Y
GLfloat dialMaxEnergy()

◆ drawForwardShieldBar:

- (void) drawForwardShieldBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2237 :(NSDictionary *)info
2238{
2239 int x, y;
2240 NSSize siz;
2241 BOOL draw_surround;
2242 GLfloat alpha = overallAlpha;
2243 GLfloat shield = [PLAYER dialForwardShield];
2244 struct CachedInfo cached;
2245
2246 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2247
2248 x = useDefined(cached.x, FORWARD_SHIELD_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2249 y = useDefined(cached.y, FORWARD_SHIELD_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2251 siz.height = useDefined(cached.height, FORWARD_SHIELD_BAR_HEIGHT);
2252 alpha *= cached.alpha;
2253 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:FORWARD_SHIELD_BAR_DRAW_SURROUND];
2254
2255 if (draw_surround)
2256 {
2257 // draw forward_shield surround
2259 hudDrawSurroundAt(x, y, z1, siz);
2260 }
2261 // draw forward_shield bar
2262 if (shield < .25)
2263 {
2265 }
2266 else if (shield < .80)
2267 {
2269 }
2270 else
2271 {
2273 }
2274 hudDrawBarAt(x, y, z1, siz, shield);
2275}
#define FORWARD_SHIELD_BAR_HEIGHT
#define FORWARD_SHIELD_BAR_WIDTH
#define FORWARD_SHIELD_BAR_CENTRE_Y
#define FORWARD_SHIELD_BAR_CENTRE_X

◆ drawFPSInfoCounter:

- (void) drawFPSInfoCounter: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3089 :(NSDictionary *)info
3090{
3091 if (![UNIVERSE displayFPS]) return;
3092
3093 int x, y;
3094 NSSize siz;
3095 struct CachedInfo cached;
3096 GLfloat textColor[4] = {0.0, 1.0, 0.0, 1.0};
3097
3098 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3099
3100 x = useDefined(cached.x, FPSINFO_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
3101 y = useDefined(cached.y, FPSINFO_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
3102 siz.width = useDefined(cached.width, FPSINFO_DISPLAY_WIDTH);
3103 siz.height = useDefined(cached.height, FPSINFO_DISPLAY_HEIGHT);
3104
3105 HPVector playerPos = [PLAYER position];
3106 NSString *positionInfo = [UNIVERSE expressPosition:playerPos inCoordinateSystem:@"pwm"];
3107 positionInfo = [NSString stringWithFormat:@"abs %.2f %.2f %.2f / %@", playerPos.x, playerPos.y, playerPos.z, positionInfo];
3108
3109 // We would normally set a variable alpha value here, but in this case we don't.
3110 // We prefer the FPS counter to be always visible - Nikos 20100405
3111 GetRGBAArrayFromInfo(info, textColor);
3112 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], 1.0f));
3113 OODrawString([PLAYER dial_fpsinfo], x, y, z1, siz);
3114
3115#ifndef NDEBUG
3116 NSSize siz08 = NSMakeSize(0.8 * siz.width, 0.8 * siz.width);
3117 NSString *collDebugInfo = [NSString stringWithFormat:@"%@ - %@", [PLAYER dial_objinfo], [UNIVERSE collisionDescription]];
3118 OODrawString(collDebugInfo, x, y - siz.height, z1, siz);
3119
3120 OODrawString(positionInfo, x, y - 1.8 * siz.height, z1, siz08);
3121
3122 NSString *timeAccelerationFactorInfo = [NSString stringWithFormat:@"TAF: %@%.2f", DESC(@"multiplication-sign"), [UNIVERSE timeAccelerationFactor]];
3123 OODrawString(timeAccelerationFactorInfo, x, y - 3.2 * siz08.height, z1, siz08);
3124#endif
3125}
#define FPSINFO_DISPLAY_Y
#define FPSINFO_DISPLAY_WIDTH
#define FPSINFO_DISPLAY_HEIGHT
#define FPSINFO_DISPLAY_X

◆ drawFuelBar:

- (void) drawFuelBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2319 :(NSDictionary *)info
2320{
2321 int x, y;
2322 NSSize siz;
2323 BOOL draw_surround;
2324 float fu, hr;
2325 GLfloat alpha = overallAlpha;
2326 struct CachedInfo cached;
2327
2328 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2329
2330 x = useDefined(cached.x, FUEL_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2331 y = useDefined(cached.y, FUEL_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2332 siz.width = useDefined(cached.width, FUEL_BAR_WIDTH);
2333 siz.height = useDefined(cached.height, FUEL_BAR_HEIGHT);
2334 alpha *= cached.alpha;
2335 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2336
2337 if (draw_surround)
2338 {
2340 hudDrawSurroundAt(x, y, z1, siz);
2341 }
2342
2343 fu = [PLAYER dialFuel];
2344 hr = [PLAYER dialHyperRange];
2345
2346 // draw fuel bar
2348 hudDrawBarAt(x, y, z1, siz, fu);
2349
2350 // draw range indicator
2351 if (hr > 0.0f && hr <= 1.0f)
2352 {
2353 if ([PLAYER hasSufficientFuelForJump])
2354 {
2356 }
2357 else
2358 {
2360 }
2361 hudDrawMarkerAt(x, y, z1, siz, hr);
2362 }
2363
2364}
#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)

◆ drawGreenSurround:

- (void) drawGreenSurround: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3318 :(NSDictionary *)info
3319{
3320 [self drawSurroundInternal:info color:green_color];
3321}

◆ drawHUDItem:

- (void) drawHUDItem: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

1109 :(NSDictionary *)info
1110{
1111 NSString *equipment = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
1112
1113 if (equipment != nil && ![PLAYER hasEquipmentItemProviding:equipment])
1114 {
1115 return;
1116 }
1117
1118 // check alert condition
1119 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1120 // 1=docked, 2=green, 4=yellow, 8=red
1121 if (alertMask < 15)
1122 {
1123 OOAlertCondition alertCondition = [PLAYER alertCondition];
1124 if (~alertMask & (1 << alertCondition)) {
1125 return;
1126 }
1127 }
1128
1129 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1130
1131 // 1=docked, 2=green, 4=yellow, 8=red
1132 if (viewOnly && [PLAYER guiScreen] != GUI_SCREEN_MAIN)
1133 {
1134 return;
1135 }
1136
1137 if (EXPECT_NOT([self hasHidden:[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR_NAME]]))
1138 {
1139 return;
1140 }
1141
1142 // use the selector value stored during init.
1143 [self performSelector:[(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR] pointerValue] withObject:info];
1144 OOCheckOpenGLErrors(@"HeadUpDisplay after drawHUDItem %@", info);
1145
1147}
#define WIDGET_SELECTOR_NAME
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:136
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:39
OOAlertCondition
Definition ShipEntity.h:172

◆ drawLegend:

- (void) drawLegend: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

1034 :(NSDictionary *)info
1035{
1036 // check if equipment is required
1037 NSString *equipmentRequired = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
1038 if (equipmentRequired != nil && ![PLAYER hasEquipmentItemProviding:equipmentRequired])
1039 {
1040 return;
1041 }
1042
1043 // check alert condition
1044 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1045 // 1=docked, 2=green, 4=yellow, 8=red
1046 if (alertMask < 15)
1047 {
1048 OOAlertCondition alertCondition = [PLAYER alertCondition];
1049 if (~alertMask & (1 << alertCondition)) {
1050 return;
1051 }
1052 }
1053
1054 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1055 // 1=docked, 2=green, 4=yellow, 8=red
1056 if (viewOnly && [PLAYER guiScreen] != GUI_SCREEN_MAIN)
1057 {
1058 return;
1059 }
1060
1061 // check association with hidden dials
1062 if ([self hasHidden:[info oo_stringForKey:DIAL_REQUIRED_KEY defaultValue:nil]])
1063 {
1064 return;
1065 }
1066
1067 OOTextureSprite *legendSprite = nil;
1068 NSString *legendText = nil;
1069 float x, y;
1070 NSSize size;
1071 GLfloat alpha = overallAlpha;
1072 struct CachedInfo cached;
1073
1074 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1075
1076 // if either x or y is missing, use 0 instead
1077
1078 x = useDefined(cached.x, 0.0f) + [[UNIVERSE gameView] x_offset] * cached.x0;
1079 y = useDefined(cached.y, 0.0f) + [[UNIVERSE gameView] y_offset] * cached.y0;
1080 alpha *= cached.alpha;
1081
1082 legendSprite = [info objectForKey:SPRITE_KEY];
1083 if (legendSprite != nil)
1084 {
1085 [legendSprite blitCentredToX:x Y:y Z:z1 alpha:alpha];
1086 }
1087 else
1088 {
1089 legendText = [info oo_stringForKey:TEXT_KEY];
1090 if (legendText != nil)
1091 {
1092 // randomly chosen default width & height
1093 size.width = useDefined(cached.width, 14.0f);
1094 size.height = useDefined(cached.height, 8.0f);
1096 if ([info oo_intForKey:@"align"] == 1)
1097 {
1098 OODrawStringAligned(legendText, x, y, z1, size, YES);
1099 }
1100 else
1101 {
1102 OODrawStringAligned(legendText, x, y, z1, size, NO);
1103 }
1104 }
1105 }
1106}
#define DIAL_REQUIRED_KEY

◆ drawLegends

- (void) drawLegends

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

864{
865 /* Since the order of legend drawing is significant, this loop must be kept
866 * as an incrementing one for compatibility with previous Oolite versions.
867 * CIM: 28/9/12 */
868 z1 = [[UNIVERSE gameView] display_z];
869 NSUInteger i, nLegends = [legendArray count];
870 for (i = 0; i < nLegends; i++)
871 {
872 sCurrentDrawItem = [legendArray oo_arrayAtIndex:i];
873 [self drawLegend:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
874 }
875}

◆ drawMFDs

- (void) drawMFDs

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

903{
904 NSUInteger i, nMFDs = [mfdArray count];
905 NSString *text = nil;
906 for (i = 0; i < nMFDs; i++)
907 {
908 text = [PLAYER multiFunctionText:i];
909 if (text != nil)
910 {
911 sCurrentDrawItem = [mfdArray oo_arrayAtIndex:i];
912 [self drawMultiFunctionDisplay:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO] withText:text asIndex:i];
913 }
914 }
915}

◆ drawMissileDisplay:

- (void) drawMissileDisplay: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2646 :(NSDictionary *)info
2647{
2648 int x, y, sp;
2649 NSSize siz;
2650 GLfloat alpha = overallAlpha;
2651 struct CachedInfo cached;
2652
2653 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2654
2655 x = useDefined(cached.x, MISSILES_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2656 y = useDefined(cached.y, MISSILES_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2658 siz.height = useDefined(cached.height, MISSILE_ICON_HEIGHT);
2659 alpha *= cached.alpha;
2660 sp = [info oo_unsignedIntForKey:SPACING_KEY defaultValue:MISSILES_DISPLAY_SPACING];
2661
2662 BOOL weaponsOnline = [PLAYER weaponsOnline];
2663 if (!weaponsOnline) alpha *= 0.2f; // darken missile display if weapons are offline
2664
2665 if (![PLAYER dialIdentEngaged])
2666 {
2667 OOMissileStatus status = [PLAYER dialMissileStatus];
2668 NSUInteger i, n_mis = [PLAYER dialMaxMissiles];
2669 for (i = 0; i < n_mis; i++)
2670 {
2671 ShipEntity *missile = [PLAYER missileForPylon:i];
2672 if (missile)
2673 {
2674 [self drawIconForMissile:missile
2675 selected:weaponsOnline && i == [PLAYER activeMissile]
2676 status:status
2677 x:x + (int)i * sp + 2 y:y
2678 width:siz.width * 0.25f height:siz.height * 0.25f
2679 alpha:alpha];
2680 }
2681 else
2682 {
2683 [self drawIconForEmptyPylonAtX:x + (int)i * sp + 2 y:y
2684 width:siz.width * 0.25f height:siz.height * 0.25f alpha:alpha];
2685 }
2686 }
2687 }
2688 else
2689 {
2690 x -= siz.width;
2691 y -= siz.height * 0.75;
2692 siz.width *= 0.80;
2693 sp *= 0.75;
2694 switch ([PLAYER dialMissileStatus])
2695 {
2697 GLColorWithOverallAlpha(green_color, alpha); break;
2699 GLColorWithOverallAlpha(yellow_color, alpha); break;
2701 GLColorWithOverallAlpha(red_color, alpha); break;
2702 }
2703 OOGLBEGIN(GL_QUADS);
2704 glVertex3i(x , y, z1);
2705 glVertex3i(x + siz.width, y, z1);
2706 glVertex3i(x + siz.width, y + siz.height, z1);
2707 glVertex3i(x , y + siz.height, z1);
2708 OOGLEND();
2709 GLColorWithOverallAlpha(green_color, alpha);
2710 OODrawString([PLAYER dialTargetName], x + sp, y - 1, z1, NSMakeSize(siz.width, siz.height));
2711 }
2712
2713}
#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

◆ drawMultiFunctionDisplay:withText:asIndex:

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

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3342 :(NSDictionary *)info withText:(NSString *)text asIndex:(NSUInteger)index
3343{
3344 PlayerEntity *player1 = PLAYER;
3345 struct CachedInfo cached;
3346 NSInteger i, x, y;
3347 NSSize siz, tmpsiz;
3348 if ([player1 guiScreen] != GUI_SCREEN_MAIN) // don't draw on text screens
3349 {
3350 return;
3351 }
3352 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
3353
3354 GLfloat mfd_color[4] = {0.0, 1.0, 0.0, 0.9*alpha};
3355 OOColor *mfdcol = [OOColor colorWithDescription:[info objectForKey:COLOR_KEY]];
3356 if (mfdcol != nil)
3357 {
3358 [mfdcol getRed:&mfd_color[0] green:&mfd_color[1] blue:&mfd_color[2] alpha:&mfd_color[3]];
3359 }
3360 if (index != [player1 activeMFD])
3361 {
3362 mfd_color[3] *= 0.75;
3363 }
3364 [self drawSurroundInternal:info color:mfd_color];
3365
3366 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3367 x = cached.x + [[UNIVERSE gameView] x_offset] * cached.x0;
3368 y = cached.y + [[UNIVERSE gameView] y_offset] * cached.y0;
3369
3370 siz.width = useDefined(cached.width / 15, MFD_TEXT_WIDTH);
3371 siz.height = useDefined(cached.height / 10, MFD_TEXT_HEIGHT);
3372
3373 GLfloat x0 = (GLfloat)(x - cached.width/2);
3374 GLfloat y0 = (GLfloat)(y + cached.height/2);
3375 GLfloat x1 = (GLfloat)(x + cached.width/2);
3376 GLfloat y1 = (GLfloat)(y - cached.height/2);
3377 GLColorWithOverallAlpha(mfd_color, alpha*0.3);
3378 OOGLBEGIN(GL_QUADS);
3379 glVertex3f(x0-2,y0+2,z1);
3380 glVertex3f(x0-2,y1-2,z1);
3381 glVertex3f(x1+2,y1-2,z1);
3382 glVertex3f(x1+2,y0+2,z1);
3383 OOGLEND();
3384
3385 NSString *line = nil;
3386 NSArray *lines = [text componentsSeparatedByString:@"\n"];
3387 // text at full opacity
3388 GLColorWithOverallAlpha(mfd_color, alpha);
3389 for (i = 0; i < 10 ; i++)
3390 {
3391 line = [lines oo_stringAtIndex:i defaultValue:nil];
3392 if (line != nil)
3393 {
3394 y0 -= siz.height;
3395 // all lines should be shorter than the size of the MFD
3396 GLfloat textwidth = OORectFromString(line, 0.0f, 0.0f, siz).size.width;
3397 if (textwidth <= cached.width)
3398 {
3399 OODrawString(line, x0, y0, z1, siz);
3400 }
3401 else
3402 {
3403 // compress it so it fits
3404 tmpsiz.height = siz.height;
3405 tmpsiz.width = siz.width * cached.width / textwidth;
3406 OODrawString(line, x0, y0, z1, tmpsiz);
3407 }
3408 }
3409 else
3410 {
3411 break;
3412 }
3413 }
3414}
#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:127

◆ drawPitchBar:

- (void) drawPitchBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2096 :(NSDictionary *)info
2097{
2098 int x, y;
2099 NSSize siz;
2100 BOOL draw_surround;
2101 GLfloat alpha = overallAlpha;
2102 struct CachedInfo cached;
2103
2104 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2105
2106 x = useDefined(cached.x, PITCH_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2107 y = useDefined(cached.y, PITCH_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2108 siz.width = useDefined(cached.width, PITCH_BAR_WIDTH);
2109 siz.height = useDefined(cached.height, PITCH_BAR_HEIGHT);
2110 alpha *= cached.alpha;
2111 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
2112
2113 if (draw_surround)
2114 {
2115 // draw PITCH surround
2117 hudDrawSurroundAt(x, y, z1, siz);
2118 }
2119 // draw PITCH bar
2121 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialPitch]);
2122}
#define PITCH_BAR_CENTRE_Y
#define PITCH_BAR_CENTRE_X
#define PITCH_BAR_HEIGHT
#define PITCH_BAR_WIDTH

◆ drawPrimedEquipmentText:

- (void) drawPrimedEquipmentText: (NSDictionary *) info

Extends class HeadUpDisplay.

◆ drawRollBar:

- (void) drawRollBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2067 :(NSDictionary *)info
2068{
2069 int x, y;
2070 NSSize siz;
2071 BOOL draw_surround;
2072 GLfloat alpha = overallAlpha;
2073 struct CachedInfo cached;
2074
2075 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2076
2077 x = useDefined(cached.x, ROLL_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2078 y = useDefined(cached.y, ROLL_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2079 siz.width = useDefined(cached.width, ROLL_BAR_WIDTH);
2080 siz.height = useDefined(cached.height, ROLL_BAR_HEIGHT);
2081 alpha *= cached.alpha;
2082 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ROLL_BAR_DRAW_SURROUND];
2083
2084 if (draw_surround)
2085 {
2086 // draw ROLL surround
2088 hudDrawSurroundAt(x, y, z1, siz);
2089 }
2090 // draw ROLL bar
2092 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialRoll]);
2093}
#define ROLL_BAR_CENTRE_Y
#define ROLL_BAR_WIDTH
#define ROLL_BAR_HEIGHT
#define ROLL_BAR_CENTRE_X

◆ drawScanner:

- (void) drawScanner: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1167 of file HeadUpDisplay.m.

1180 :(NSDictionary *)info
1181{
1182 int i, x, y;
1183 NSSize siz;
1184 GLfloat scanner_color[4] = { 1.0, 0.0, 0.0, 1.0 };
1185
1186 BOOL emptyDial = ([info oo_floatForKey:ALPHA_KEY] == 0.0f);
1187
1188 BOOL isHostile = NO;
1189
1190 BOOL inColorBlindMode = [UNIVERSE colorblindMode] != OO_POSTFX_NONE;
1191
1192 if (emptyDial)
1193 {
1194 // we can skip a lot of code.
1195 x = y = 0;
1196 scanner_color[3] = 0.0; // nothing to see!
1197 siz = NSMakeSize(1.0, 1.0); // avoid divide by 0s
1198 }
1199 else
1200 {
1201 struct CachedInfo cached;
1202
1203 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1204
1205 x = useDefined(cached.x, SCANNER_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1206 y = useDefined(cached.y, SCANNER_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1207 siz.width = useDefined(cached.width, SCANNER_WIDTH);
1208 siz.height = useDefined(cached.height, SCANNER_HEIGHT);
1209
1210 GetRGBAArrayFromInfo(info, scanner_color);
1211
1212 scanner_color[3] *= overallAlpha;
1213 }
1214
1215 GLfloat alpha = scanner_color[3];
1216 GLfloat col[4] = { 1.0, 1.0, 1.0, alpha }; // temporary colour variable
1217
1218 GLfloat z_factor = siz.height / siz.width; // approx 1/4
1219 GLfloat y_factor = 1.0 - sqrt(z_factor); // approx 1/2
1220
1221 int scanner_cx = x;
1222 int scanner_cy = y;
1223
1224 int scannerFootprint = SCANNER_MAX_RANGE * 2.5 / siz.width;
1225
1226 GLfloat zoom = scanner_zoom;
1227 if (scanner_ultra_zoom)
1228 zoom = pow(2, zoom - 1.0);
1229 GLfloat max_zoomed_range2 = SCANNER_SCALE * SCANNER_SCALE * 10000.0;
1230 if (!nonlinear_scanner)
1231 {
1232 max_zoomed_range2 /= zoom * zoom;
1233 }
1234 GLfloat max_zoomed_range = sqrt(max_zoomed_range2);
1235
1236 if (PLAYER == nil) return;
1237
1238 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1239 Vector relativePosition;
1240 int flash = ((int)([UNIVERSE getTime] * 4))&1;
1241
1242 // use a non-mutable copy so this can't be changed under us.
1243 int ent_count = UNIVERSE->n_entities;
1244 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
1245 Entity *my_entities[ent_count];
1246 Entity *scannedEntity = nil;
1247
1248 for (i = 0; i < ent_count; i++)
1249 {
1250 my_entities[i] = [uni_entities[i] retain]; // retained
1251 }
1252
1253 if (!emptyDial)
1254 {
1255 OOGL(glColor4fv(scanner_color));
1256 drawScannerGrid(x, y, z1, siz, [UNIVERSE viewDirection], lineWidth, zoom, nonlinear_scanner, minimalistic_scanner);
1257 }
1258
1259 if ([self checkPlayerInFlight])
1260 {
1261 GLfloat upscale = zoom * 1.25 / scannerFootprint;
1262 GLfloat max_blip = 0.0;
1263 int drawClass;
1264
1266
1267 // Debugging code for nonlinear scanner - draws three fake cascade weapons, which looks pretty and enables me
1268 // to debug the code without the mass slaughter of innocent civillians.
1269 //if (nonlinear_scanner)
1270 //{
1271 // Vector p = OOVectorMultiplyMatrix(make_vector(10000.0, 0.0, 0.0), rotMatrix);
1272 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 5000, zoom, alpha );
1273 // p = OOVectorMultiplyMatrix(make_vector(10000.0, 4500.0, 0.0), rotMatrix);
1274 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 2000, zoom, alpha );
1275 // p = OOVectorMultiplyMatrix(make_vector(0.0, 0.0, 20000.0), rotMatrix);
1276 // GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, p, 6000, zoom, alpha );
1277 //}
1278 for (i = 0; i < ent_count; i++) // scanner lollypops
1279 {
1280 scannedEntity = my_entities[i];
1281
1282 drawClass = [scannedEntity scanClass];
1283
1284 // cloaked ships - and your own one - don't show up on the scanner.
1285 if (EXPECT_NOT(drawClass == CLASS_PLAYER || ([scannedEntity isShip] && [(ShipEntity *)scannedEntity isCloaked])))
1286 {
1287 drawClass = CLASS_NO_DRAW;
1288 }
1289
1290 if (drawClass != CLASS_NO_DRAW)
1291 {
1292 GLfloat x1,y1,y2;
1293 float ms_blip = 0.0;
1294
1295 if (emptyDial) continue;
1296
1297 if (isnan(scannedEntity->zero_distance))
1298 continue;
1299
1300 // exit if it's too far away
1301 GLfloat act_dist = sqrt(scannedEntity->zero_distance);
1302 GLfloat lim_dist = act_dist - scannedEntity->collision_radius;
1303
1304 // for efficiency, assume no scannable entity > 10km radius
1305 if (act_dist > max_zoomed_range + 10000.0)
1306 break;
1307
1308 if (lim_dist > max_zoomed_range)
1309 continue;
1310
1311 // has it sent a recent message
1312 //
1313 if ([scannedEntity isShip])
1314 ms_blip = 2.0 * [(ShipEntity *)scannedEntity messageTime];
1315 if (ms_blip > max_blip)
1316 {
1317 max_blip = ms_blip;
1318 last_transmitter = [scannedEntity universalID];
1319 }
1320 ms_blip -= floor(ms_blip);
1321
1322 relativePosition = [PLAYER vectorTo:scannedEntity];
1323 double fuzz = [PLAYER scannerFuzziness];
1324 if (fuzz > 0 && ![[UNIVERSE gameController] isGamePaused])
1325 {
1326 relativePosition = vector_add(relativePosition,OOVectorRandomRadial(fuzz));
1327 }
1328
1329 Vector rp = relativePosition;
1330
1331 if (act_dist > max_zoomed_range)
1332 scale_vector(&relativePosition, max_zoomed_range / act_dist);
1333
1334 // rotate the view
1335 relativePosition = OOVectorMultiplyMatrix(relativePosition, rotMatrix);
1336 Vector rrp = relativePosition;
1337 // scale the view
1338 if (nonlinear_scanner)
1339 {
1340 relativePosition = [HeadUpDisplay nonlinearScannerScale: relativePosition Zoom: zoom Scale: 0.5*siz.width];
1341 }
1342 else
1343 {
1344 scale_vector(&relativePosition, upscale);
1345 }
1346
1347 x1 = relativePosition.x;
1348 y1 = z_factor * relativePosition.z;
1349 y2 = y1 + y_factor * relativePosition.y;
1350
1351 isHostile = NO;
1352 if ([scannedEntity isShip])
1353 {
1354 ShipEntity *ship = (ShipEntity *)scannedEntity;
1355 isHostile = (([ship hasHostileTarget])&&([ship primaryTarget] == PLAYER));
1356 GLfloat *base_col = [ship scannerDisplayColorForShip:PLAYER :isHostile :flash
1359 ];
1360 col[0] = base_col[0]; col[1] = base_col[1]; col[2] = base_col[2]; col[3] = alpha * base_col[3];
1361 }
1362 else if ([scannedEntity isVisualEffect])
1363 {
1364 OOVisualEffectEntity *vis = (OOVisualEffectEntity *)scannedEntity;
1365 GLfloat* base_col = [vis scannerDisplayColorForShip:flash :[vis scannerDisplayColor1] :[vis scannerDisplayColor2]];
1366 col[0] = base_col[0]; col[1] = base_col[1]; col[2] = base_col[2]; col[3] = alpha * base_col[3];
1367 }
1368
1369 if ([scannedEntity isWormhole])
1370 {
1371 col[0] = blue_color[0]; col[1] = (flash)? 1.0 : blue_color[1]; col[2] = blue_color[2]; col[3] = alpha * blue_color[3];
1372 }
1373
1374 // position the scanner
1375 x1 += scanner_cx; y1 += scanner_cy; y2 += scanner_cy;
1376
1377 if ([scannedEntity isShip])
1378 {
1379 ShipEntity* ship = (ShipEntity*)scannedEntity;
1380 if ((!nonlinear_scanner && ship->collision_radius * upscale > 4.5) ||
1381 (nonlinear_scanner && nonlinearScannerFunc(act_dist, zoom, siz.width) - nonlinearScannerFunc(lim_dist, zoom, siz.width) > 4.5 ))
1382 {
1383 Vector bounds[6];
1384 BoundingBox bb = ship->totalBoundingBox;
1385 bounds[0] = ship->v_forward; scale_vector(&bounds[0], bb.max.z);
1386 bounds[1] = ship->v_forward; scale_vector(&bounds[1], bb.min.z);
1387 bounds[2] = ship->v_right; scale_vector(&bounds[2], bb.max.x);
1388 bounds[3] = ship->v_right; scale_vector(&bounds[3], bb.min.x);
1389 bounds[4] = ship->v_up; scale_vector(&bounds[4], bb.max.y);
1390 bounds[5] = ship->v_up; scale_vector(&bounds[5], bb.min.y);
1391 // rotate the view
1392 int i;
1393 for (i = 0; i < 6; i++)
1394 {
1395 bounds[i] = OOVectorMultiplyMatrix(vector_add(bounds[i], rp), rotMatrix);
1396 if (nonlinear_scanner)
1397 {
1398 bounds[i] = [HeadUpDisplay nonlinearScannerScale:bounds[i] Zoom: zoom Scale: 0.5*siz.width];
1399 }
1400 else
1401 {
1402 scale_vector(&bounds[i], upscale);
1403 }
1404 bounds[i] = make_vector(bounds[i].x + scanner_cx, bounds[i].z * z_factor + bounds[i].y * y_factor + scanner_cy, z1 );
1405 }
1406 // draw the diamond
1407 //
1408 OOGLBEGIN(GL_QUADS);
1409 glColor4f(col[0], col[1], col[2], 0.33333 * col[3]);
1410 glVertex3f(bounds[0].x, bounds[0].y, bounds[0].z); glVertex3f(bounds[4].x, bounds[4].y, bounds[4].z);
1411 glVertex3f(bounds[1].x, bounds[1].y, bounds[1].z); glVertex3f(bounds[5].x, bounds[5].y, bounds[5].z);
1412 glVertex3f(bounds[2].x, bounds[2].y, bounds[2].z); glVertex3f(bounds[4].x, bounds[4].y, bounds[4].z);
1413 glVertex3f(bounds[3].x, bounds[3].y, bounds[3].z); glVertex3f(bounds[5].x, bounds[5].y, bounds[5].z);
1414 glVertex3f(bounds[2].x, bounds[2].y, bounds[2].z); glVertex3f(bounds[0].x, bounds[0].y, bounds[0].z);
1415 glVertex3f(bounds[3].x, bounds[3].y, bounds[3].z); glVertex3f(bounds[1].x, bounds[1].y, bounds[1].z);
1416 OOGLEND();
1417 }
1418 }
1419
1420 if (ms_blip > 0.0)
1421 {
1422 DrawSpecialOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(16.0 * (1.0 - ms_blip), 8.0 * (1.0 - ms_blip)), 30, col);
1423 }
1424 if ([scannedEntity isCascadeWeapon])
1425 {
1426 if (nonlinear_scanner)
1427 {
1428 GLDrawNonlinearCascadeWeapon( scanner_cx, scanner_cy, z1, siz, rrp, scannedEntity->collision_radius, zoom, alpha );
1429 }
1430 else
1431 {
1432 GLfloat r1 = 2.5 + scannedEntity->collision_radius * upscale;
1433 GLfloat l2 = r1 * r1 - relativePosition.y * relativePosition.y;
1434 GLfloat r0 = (l2 > 0)? sqrt(l2): 0;
1435 if (r0 > 0)
1436 {
1437 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
1438 GLDrawOval(x1 - 0.5, y1 + 1.5, z1, NSMakeSize(r0, r0 * siz.height / siz.width), 20);
1439 }
1440 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
1441 GLDrawFilledOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(r1, r1), 15);
1442 }
1443 }
1444 else
1445 {
1446
1447#if IDENTIFY_SCANNER_LOLLIPOPS
1448 if ([scannedEntity isShip])
1449 {
1450 glColor4f(1.0, 1.0, 0.5, alpha);
1451 OODrawString([(ShipEntity *)scannedEntity displayName], x1 + 2, y2 + 2, z1, NSMakeSize(8, 8));
1452 }
1453#endif
1454 glColor4fv(col);
1455 if (inColorBlindMode && isHostile)
1456 {
1457 // in colorblind mode turn hostile blips into X shapes for easier recognition
1458 OOGLBEGIN(GL_LINES);
1459 glVertex3f(x1+2, y2+3, z1); glVertex3f(x1-3, y2, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1-3, y2+3, z1);
1460 OOGLEND();
1461 }
1462 else
1463 {
1464 OOGLBEGIN(GL_QUADS);
1465 glVertex3f(x1-3, y2, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1+2, y2+3, z1); glVertex3f(x1-3, y2+3, z1);
1466 OOGLEND();
1467 }
1468 OOGLBEGIN(GL_QUADS); // lollipop tail
1469 col[3] *= 0.3333; // one third the alpha
1470 glColor4fv(col);
1471 glVertex3f(x1, y1, z1); glVertex3f(x1+2, y1, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1, y2, z1);
1472 OOGLEND();
1473 }
1474 }
1475 }
1476
1477 }
1478
1479 for (i = 0; i < ent_count; i++)
1480 {
1481 [my_entities[i] release]; // released
1482 }
1483
1485
1486}
#define SCANNER_MAX_RANGE
Definition Entity.h:51
#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)
Vector OOVectorRandomRadial(OOScalar maxLength)
Definition OOVector.m:115
@ OO_POSTFX_NONE
Definition Universe.h:90
GLfloat collision_radius
Definition Entity.h:111
OOUniversalID universalID
Definition Entity.h:89
GLfloat zero_distance
Definition Entity.h:108
OOScanClass scanClass
Definition Entity.h:106
Vector nonlinearScannerScale:Zoom:Scale:(Vector V,[Zoom] GLfloat zoom,[Scale] double scale)
Vector v_forward
Definition ShipEntity.h:200
OOColor * scannerDisplayColor2()
BoundingBox totalBoundingBox
Definition ShipEntity.h:213
Vector v_up
Definition ShipEntity.h:200
OOColor * scannerDisplayColorHostile2()
OOColor * scannerDisplayColorHostile1()
BOOL hasHostileTarget()
OOColor * scannerDisplayColor1()
Vector v_right
Definition ShipEntity.h:200

◆ drawScannerZoomIndicator:

- (void) drawScannerZoomIndicator: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1167 of file HeadUpDisplay.m.

1544 :(NSDictionary *)info
1545{
1546 int x, y;
1547 NSSize siz;
1548 GLfloat alpha;
1549 GLfloat zoom_color[4] = { 1.0f, 0.1f, 0.0f, 1.0f };
1550 struct CachedInfo cached;
1551
1552 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1553
1554 x = useDefined(cached.x, ZOOM_INDICATOR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
1555 y = useDefined(cached.y, ZOOM_INDICATOR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
1557 siz.height = useDefined(cached.height, ZOOM_INDICATOR_HEIGHT);
1558
1559 GetRGBAArrayFromInfo(info, zoom_color);
1560 zoom_color[3] *= overallAlpha;
1561 alpha = zoom_color[3];
1562
1563 GLfloat cx = x - 0.3 * siz.width;
1564 GLfloat cy = y - 0.75 * siz.height;
1565
1566 int zl = scanner_zoom;
1567 if (zl < 1) zl = 1;
1569 if (zl == 1) zoom_color[3] *= 0.75;
1570 if (scanner_ultra_zoom)
1571 zl = pow(2, zl - 1);
1572 GLColorWithOverallAlpha(zoom_color, alpha);
1573 OOGL(glEnable(GL_TEXTURE_2D));
1574 [sFontTexture apply];
1575
1576 OOGLBEGIN(GL_QUADS);
1577 if (zl / 10 > 0)
1578 drawCharacterQuad(48 + zl / 10, cx - 0.8 * siz.width, cy, z1, siz);
1579 drawCharacterQuad(48 + zl % 10, cx - 0.4 * siz.width, cy, z1, siz);
1580 drawCharacterQuad(58, cx, cy, z1, siz);
1581 drawCharacterQuad(49, cx + 0.3 * siz.width, cy, z1, siz);
1582 OOGLEND();
1583
1585 OOGL(glDisable(GL_TEXTURE_2D));
1586}
#define ZOOM_INDICATOR_HEIGHT
#define ZOOM_INDICATOR_WIDTH
#define SCANNER_ZOOM_LEVELS
#define ZOOM_INDICATOR_CENTRE_X
#define ZOOM_INDICATOR_CENTRE_Y
void applyNone()
Definition OOTexture.m:275

◆ drawScoopStatus:

- (void) drawScoopStatus: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3128 :(NSDictionary *)info
3129{
3130 int i, x, y;
3131 NSSize siz;
3132 GLfloat alpha;
3133 struct CachedInfo cached;
3134
3135 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3136
3137 x = useDefined(cached.x, SCOOPSTATUS_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
3138 y = useDefined(cached.y, SCOOPSTATUS_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
3139 siz.width = useDefined(cached.width, SCOOPSTATUS_WIDTH);
3140 siz.height = useDefined(cached.height, SCOOPSTATUS_HEIGHT);
3141 // default alpha value different from all others, won't use cached.alpha
3142 alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:0.75f];
3143
3144 const GLfloat* s0_color = red_color;
3145 GLfloat s1c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3146 GLfloat s2c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3147 GLfloat s3c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3148 int scoop_status = [PLAYER dialFuelScoopStatus];
3149 GLfloat t = [UNIVERSE getTime];
3150 GLfloat a1 = alpha * 0.5f * (1.0f + sin(t * 8.0f));
3151 GLfloat a2 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 1.0f));
3152 GLfloat a3 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 2.0f));
3153
3154 switch (scoop_status)
3155 {
3157 return; // don't draw
3158
3160 s0_color = darkgreen_color;
3161 alpha *= 0.75;
3162 break;
3163
3165 case SCOOP_STATUS_OKAY:
3166 s0_color = green_color;
3167 break;
3168 }
3169
3170 for (i = 0; i < 3; i++)
3171 {
3172 s1c[i] = s0_color[i];
3173 s2c[i] = s0_color[i];
3174 s3c[i] = s0_color[i];
3175 }
3176 if (scoop_status == SCOOP_STATUS_FULL_HOLD)
3177 {
3178 s3c[0] = red_color[0];
3179 s3c[1] = red_color[1];
3180 s3c[2] = red_color[2];
3181 }
3182 if (scoop_status == SCOOP_STATUS_ACTIVE)
3183 {
3184 s1c[3] = alpha * a1;
3185 s2c[3] = alpha * a2;
3186 s3c[3] = alpha * a3;
3187 }
3188 else
3189 {
3190 s1c[3] = alpha;
3191 s2c[3] = alpha;
3192 s3c[3] = alpha;
3193 }
3194
3195 GLfloat w1 = siz.width / 8.0;
3196 GLfloat w2 = 2.0 * w1;
3197// GLfloat w3 = 3.0 * w1;
3198 GLfloat w4 = 4.0 * w1;
3199 GLfloat h1 = siz.height / 8.0;
3200 GLfloat h2 = 2.0 * h1;
3201 GLfloat h3 = 3.0 * h1;
3202 GLfloat h4 = 4.0 * h1;
3203
3204 OOGL(glDisable(GL_TEXTURE_2D));
3205 OOGLBEGIN(GL_QUADS);
3206 // section 1
3207 GLColorWithOverallAlpha(s1c, overallAlpha);
3208 glVertex3f(x, y + h1, z1); glVertex3f(x - w2, y + h2, z1); glVertex3f(x, y + h3, z1); glVertex3f(x + w2, y + h2, z1);
3209 // section 2
3210 GLColorWithOverallAlpha(s2c, overallAlpha);
3211 glVertex3f(x, y - h1, z1); glVertex3f(x - w4, y + h1, z1); glVertex3f(x - w4, y + h2, z1); glVertex3f(x, y, z1);
3212 glVertex3f(x, y - h1, z1); glVertex3f(x + w4, y + h1, z1); glVertex3f(x + w4, y + h2, z1); glVertex3f(x, y, z1);
3213 // section 3
3214 GLColorWithOverallAlpha(s3c, overallAlpha);
3215 glVertex3f(x, y - h4, z1); glVertex3f(x - w2, y - h2, z1); glVertex3f(x - w2, y - h1, z1); glVertex3f(x, y - h2, z1);
3216 glVertex3f(x, y - h4, z1); glVertex3f(x + w2, y - h2, z1); glVertex3f(x + w2, y - h1, z1); glVertex3f(x, y - h2, z1);
3217 OOGLEND();
3218}
#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

◆ drawSecondaryTargetReticle:

- (void) drawSecondaryTargetReticle: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2733 :(NSDictionary *)info
2734{
2735 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha * 0.4;
2736
2737 PlayerEntity *player = PLAYER;
2738 if ([player hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"])
2739 {
2740 // needs target memory to be working in addition to any other equipment
2741 // this item may be bound to
2742 NSMutableArray *targetMemory = [player targetMemory];
2743 ShipEntity *primary = [player primaryTarget];
2744 for (unsigned i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
2745 {
2746 id sec_id = [targetMemory objectAtIndex:i];
2747 // isProxy = weakref ; not = NSNull (in this case...)
2748 // can't use isKindOfClass because that throws
2749 // NSInvalidArgumentException when called on a weakref
2750 // with a dropped object.
2751 // TODO: fix OOWeakReference so isKindOfClass works
2752 if (sec_id != nil && [sec_id isProxy])
2753 {
2754 ShipEntity *secondary = [(OOWeakReference *)sec_id weakRefUnderlyingObject];
2755 if (secondary != nil && secondary != primary)
2756 {
2757 if ([secondary zeroDistance] <= SCANNER_MAX_RANGE2 && [secondary isInSpace])
2758 {
2759 hudDrawReticleOnTarget(secondary, PLAYER, z1, alpha, NO, nil, YES, NO, info, _reticleColors);
2760 }
2761 }
2762 }
2763 }
2764 }
2765}
#define SCANNER_MAX_RANGE2
Definition Entity.h:52
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()

◆ drawSpeedBar:

- (void) drawSpeedBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2023 :(NSDictionary *)info
2024{
2025 int x, y;
2026 NSSize siz;
2027 BOOL draw_surround;
2028 GLfloat alpha = overallAlpha;
2029 GLfloat ds = [PLAYER dialSpeed];
2030 struct CachedInfo cached;
2031
2032 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2033
2034 x = useDefined(cached.x, SPEED_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2035 y = useDefined(cached.y, SPEED_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2036 siz.width = useDefined(cached.width, SPEED_BAR_WIDTH);
2037 siz.height = useDefined(cached.height, SPEED_BAR_HEIGHT);
2038 alpha *= cached.alpha;
2039
2040 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:SPEED_BAR_DRAW_SURROUND];
2041
2042
2044 if (draw_surround)
2045 {
2046 // draw speed surround
2047 hudDrawSurroundAt(x, y, z1, siz);
2048 }
2049 // draw speed bar
2050 if (ds > .80)
2051 {
2053 }
2054 else if (ds > .25)
2055 {
2057 }
2058 else
2059 {
2061 }
2062
2063 hudDrawBarAt(x, y, z1, siz, ds);
2064}
#define SPEED_BAR_CENTRE_Y
#define SPEED_BAR_WIDTH
#define SPEED_BAR_HEIGHT
#define SPEED_BAR_CENTRE_X

◆ drawStatusLight:

- (void) drawStatusLight: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2785 :(NSDictionary *)info
2786{
2787 int x, y;
2788 NSSize siz;
2789 GLfloat alpha = overallAlpha;
2790 BOOL blueAlert = cloakIndicatorOnStatusLight && [PLAYER isCloaked];
2791 struct CachedInfo cached;
2792
2793 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2794
2795 x = useDefined(cached.x, STATUS_LIGHT_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2796 y = useDefined(cached.y, STATUS_LIGHT_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2798 siz.height = useDefined(cached.height, STATUS_LIGHT_HEIGHT);
2799 alpha *= cached.alpha;
2800
2801 GLfloat status_color[4] = { 0.25, 0.25, 0.25, 1.0};
2802 int alertCondition = [PLAYER alertCondition];
2803 GLfloat flash_alpha = 0.333 * (2.0f + sin((GLfloat)[UNIVERSE getTime] * 2.5f * alertCondition));
2804
2805 switch(alertCondition)
2806 {
2808 status_color[0] = red_color[0];
2809 status_color[1] = red_color[1];
2810 status_color[2] = blueAlert ? blue_color[2] : red_color[2];
2811 break;
2812
2814 status_color[0] = green_color[0];
2815 status_color[1] = green_color[1];
2816 status_color[2] = blueAlert ? blue_color[2] : green_color[2];
2817 break;
2818
2820 status_color[0] = yellow_color[0];
2821 status_color[1] = yellow_color[1];
2822 status_color[2] = blueAlert ? blue_color[2] : yellow_color[2];
2823 break;
2824
2825 default:
2827 break;
2828 }
2829 status_color[3] = flash_alpha;
2830 GLColorWithOverallAlpha(status_color, alpha);
2831 OOGLBEGIN(GL_POLYGON);
2832 hudDrawStatusIconAt(x, y, z1, siz);
2833 OOGLEND();
2834 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
2835 OOGLBEGIN(GL_LINE_LOOP);
2836 hudDrawStatusIconAt(x, y, z1, siz);
2837 OOGLEND();
2838}
#define STATUS_LIGHT_CENTRE_X
#define STATUS_LIGHT_CENTRE_Y
#define STATUS_LIGHT_HEIGHT
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:176
@ ALERT_CONDITION_RED
Definition ShipEntity.h:178
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:177
@ ALERT_CONDITION_DOCKED
Definition ShipEntity.h:175

◆ drawStickSensitivityIndicator:

- (void) drawStickSensitivityIndicator: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3221 :(NSDictionary *)info
3222{
3223 GLfloat x, y;
3224 NSSize siz;
3225 GLfloat alpha = overallAlpha;
3226 BOOL mouse = [PLAYER isMouseControlOn];
3228 struct CachedInfo cached;
3229
3230 if (![stickHandler joystickCount])
3231 {
3232 return; // no need to draw if no joystick fitted
3233 }
3234
3235 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3236
3237 x = useDefined(cached.x, STATUS_LIGHT_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
3238 y = useDefined(cached.y, STATUS_LIGHT_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
3239 siz.width = useDefined(cached.width, STATUS_LIGHT_HEIGHT);
3240 siz.height = useDefined(cached.height, STATUS_LIGHT_HEIGHT);
3241 alpha *= cached.alpha;
3242
3243 GLfloat div = [stickHandler getSensitivity];
3244
3245 GLColorWithOverallAlpha(black_color, alpha / 4);
3246 GLDrawFilledOval(x, y, z1, siz, 10);
3247
3248 GLColorWithOverallAlpha((div < 1.0 || mouse) ? lightgray_color : green_color, alpha);
3249 OOGL(GLScaledLineWidth(_crosshairWidth * lineWidth));
3250
3251 if (div >= 1.0)
3252 {
3253 if (!mouse)
3254 {
3255 NSSize siz8th = { siz.width / 8, siz.height / 8 };
3256 GLDrawFilledOval(x, y, z1, siz8th, 30);
3257
3258 if (div == 1.0) // normal mode
3259 GLColorWithOverallAlpha(lightgray_color, alpha);
3260 }
3261
3262 siz.width -= _crosshairWidth * lineWidth / 2;
3263 siz.height -= _crosshairWidth * lineWidth / 2;
3264 GLDrawOval(x, y, z1, siz, 10);
3265 }
3266 else if (div < 1.0) // insensitive mode (shouldn't happen)
3267 GLDrawFilledOval(x, y, z1, siz, 10);
3268
3269 OOGL(GLScaledLineWidth(lineWidth)); // reset
3270}
static const GLfloat lightgray_color[4]
static const GLfloat black_color[4]

◆ drawSurround:

- (void) drawSurround: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3299 :(NSDictionary *)info
3300{
3301 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
3302 id colorDesc = [info objectForKey:COLOR_KEY];
3303 if (colorDesc != nil)
3304 {
3305 OOColor *color = [OOColor colorWithDescription:colorDesc];
3306 if (color != nil)
3307 {
3308 itemColor[0] = [color redComponent];
3309 itemColor[1] = [color greenComponent];
3310 itemColor[2] = [color blueComponent];
3311 }
3312 }
3313
3314 [self drawSurroundInternal:info color:itemColor];
3315}

◆ drawSurroundInternal:color:

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

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3273 :(NSDictionary *)info color:(const GLfloat[4])color
3274{
3275 NSInteger x, y;
3276 NSSize siz;
3277 GLfloat alpha = overallAlpha;
3278 struct CachedInfo cached;
3279
3280 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3281
3282 if (cached.x == NOT_DEFINED || cached.y == NOT_DEFINED || cached.width == NOT_DEFINED || cached.height == NOT_DEFINED)
3283 {
3284 return;
3285 }
3286
3287 x = cached.x + [[UNIVERSE gameView] x_offset] * cached.x0;
3288 y = cached.y + [[UNIVERSE gameView] y_offset] * cached.y0;
3289 siz.width = useDefined(cached.width, WEAPONSOFFLINETEXT_WIDTH);
3290 siz.height = useDefined(cached.height, WEAPONSOFFLINETEXT_HEIGHT);
3291 alpha *= cached.alpha;
3292
3293 // draw the surround
3294 GLColorWithOverallAlpha(color, alpha);
3295 hudDrawSurroundAt(x, y, z1, siz);
3296}
#define WEAPONSOFFLINETEXT_WIDTH
#define WEAPONSOFFLINETEXT_HEIGHT
#define NOT_DEFINED

◆ drawTargetReticle:

- (void) drawTargetReticle: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2716 :(NSDictionary *)info
2717{
2718 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2719
2720 if ([PLAYER primaryTarget] != nil)
2721 {
2722 hudDrawReticleOnTarget([PLAYER primaryTarget], PLAYER, z1, alpha, reticleTargetSensitive, propertiesReticleTargetSensitive, NO, YES, info, _reticleColors);
2723 [self drawDirectionCue:info];
2724 }
2725 // extra feature if extra equipment installed
2726 if ([PLAYER hasEquipmentItemProviding:@"EQ_INTEGRATED_TARGETING_SYSTEM"])
2727 {
2728 [self drawSecondaryTargetReticle:info];
2729 }
2730}

◆ drawTrumbles:

- (void) drawTrumbles: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3330 :(NSDictionary *)info
3331{
3332 OOTrumble** trumbles = [PLAYER trumbleArray];
3333 NSUInteger i;
3334 for (i = [PLAYER trumbleCount]; i > 0; i--)
3335 {
3336 OOTrumble* trum = trumbles[i - 1];
3337 [trum drawTrumble: z1];
3338 }
3339}
void drawTrumble:(double z)
Definition OOTrumble.m:371

◆ drawWaypoints:

- (void) drawWaypoints: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

2768 :(NSDictionary *)info
2769{
2770 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2771 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
2772
2773 NSEnumerator *waypoints = [[UNIVERSE currentWaypoints] objectEnumerator];
2774 OOWaypointEntity *waypoint = nil;
2775 Entity *compass = [PLAYER compassTarget];
2776
2777 while ((waypoint = [waypoints nextObject]))
2778 {
2779 hudDrawWaypoint(waypoint, PLAYER, z1, alpha, waypoint==compass, scale);
2780 }
2781
2782}
static void hudDrawWaypoint(OOWaypointEntity *waypoint, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL selected, GLfloat scale)

◆ drawWeaponsOfflineText:

- (void) drawWeaponsOfflineText: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3049 :(NSDictionary *)info
3050{
3051 OOViewID viewID = [UNIVERSE viewDirection];
3052 GLfloat textColor[4] = {0.0f, 1.0f, 0.0f, 1.0f};
3053
3054 if (viewID == VIEW_CUSTOM ||
3055 overallAlpha == 0.0f ||
3056 !([PLAYER status] == STATUS_IN_FLIGHT || [PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
3057 [UNIVERSE displayGUI]
3058 )
3059 {
3060 // Don't draw weapons offline text
3061 return;
3062 }
3063
3064 if (![PLAYER weaponsOnline])
3065 {
3066 int x, y;
3067 NSSize siz;
3068 GLfloat alpha = overallAlpha;
3069 struct CachedInfo cached;
3070
3071 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3072
3073 x = useDefined(cached.x, WEAPONSOFFLINETEXT_DISPLAY_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
3074 y = useDefined(cached.y, WEAPONSOFFLINETEXT_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
3076 siz.height = useDefined(cached.height, WEAPONSOFFLINETEXT_HEIGHT);
3077 alpha *= cached.alpha;
3078
3079 GetRGBAArrayFromInfo(info, textColor);
3080 textColor[3] *= overallAlpha;
3081
3082 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], textColor[3]));
3083 // TODO: some caching required...
3084 OODrawString(DESC(@"weapons-systems-offline"), x, y, z1, siz);
3085 }
3086}
#define WEAPONSOFFLINETEXT_DISPLAY_X
#define WEAPONSOFFLINETEXT_DISPLAY_Y
#define DESC(key)
Definition Universe.h:839

◆ drawWeaponTempBar:

- (void) drawWeaponTempBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2453 :(NSDictionary *)info
2454{
2455 int x, y;
2456 NSSize siz;
2457 BOOL draw_surround;
2458 GLfloat temp = [PLAYER laserHeatLevel];
2459 GLfloat alpha = overallAlpha;
2460 struct CachedInfo cached;
2461
2462 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2463
2464 x = useDefined(cached.x, WEAPON_TEMP_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2465 y = useDefined(cached.y, WEAPON_TEMP_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2467 siz.height = useDefined(cached.height, WEAPON_TEMP_BAR_HEIGHT);
2468 alpha *= cached.alpha;
2469 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2470
2471 if (draw_surround)
2472 {
2474 hudDrawSurroundAt(x, y, z1, siz);
2475 }
2476
2477 // draw weapon_temp bar (only need to call GLColor() once!)
2478 if (temp > .80)
2480 else if (temp > .25)
2482 else
2484 hudDrawBarAt(x, y, z1, siz, temp);
2485}
#define WEAPON_TEMP_BAR_HEIGHT
#define WEAPON_TEMP_BAR_WIDTH
#define WEAPON_TEMP_BAR_CENTRE_X
#define WEAPON_TEMP_BAR_CENTRE_Y

◆ drawWitchspaceDestination:

- (void) drawWitchspaceDestination: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2367 :(NSDictionary *)info
2368{
2369 // A zero-distance jump counts as 0.1LY
2370 if ([PLAYER dialHyperRange] == 0.0f)
2371 {
2372 return;
2373 }
2374
2375 int x, y;
2376 NSSize siz;
2377 GLfloat alpha = overallAlpha;
2378
2379 struct CachedInfo cached;
2380
2381 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2382
2383 x = useDefined(cached.x, WITCHDEST_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2384 y = useDefined(cached.y, WITCHDEST_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2385 siz.width = useDefined(cached.width, WITCHDEST_WIDTH);
2386 siz.height = useDefined(cached.height, WITCHDEST_HEIGHT);
2387 alpha *= cached.alpha;
2388 NSString *dest = [UNIVERSE getSystemName:[PLAYER targetSystemID]];
2389 NSInteger concealment = [[[UNIVERSE systemManager] getPropertiesForSystem:[PLAYER targetSystemID] inGalaxy:[PLAYER galaxyNumber]] oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
2390 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME) dest = DESC(@"status-unknown-system");
2391
2393
2394 if ([info oo_intForKey:@"align"] == 1)
2395 {
2396 OODrawStringAligned(dest, x, y, z1, siz, YES);
2397 }
2398 else
2399 {
2400 OODrawStringAligned(dest, x, y, z1, siz, NO);
2401 }
2402
2403}
#define WITCHDEST_WIDTH
#define WITCHDEST_HEIGHT
#define WITCHDEST_CENTRE_X
#define WITCHDEST_CENTRE_Y
@ OO_SYSTEMCONCEALMENT_NONAME

◆ drawYawBar:

- (void) drawYawBar: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 1687 of file HeadUpDisplay.m.

2125 :(NSDictionary *)info
2126{
2127 int x, y;
2128 NSSize siz;
2129 BOOL draw_surround;
2130 GLfloat alpha = overallAlpha;
2131 struct CachedInfo cached;
2132
2133 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2134
2135 // No standard YAW definitions - using PITCH ones instead.
2136 x = useDefined(cached.x, PITCH_BAR_CENTRE_X) + [[UNIVERSE gameView] x_offset] * cached.x0;
2137 y = useDefined(cached.y, PITCH_BAR_CENTRE_Y) + [[UNIVERSE gameView] y_offset] * cached.y0;
2138 siz.width = useDefined(cached.width, PITCH_BAR_WIDTH);
2139 siz.height = useDefined(cached.height, PITCH_BAR_HEIGHT);
2140 alpha *= cached.alpha;
2141 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
2142
2143 if (draw_surround)
2144 {
2145 // draw YAW surround
2147 hudDrawSurroundAt(x, y, z1, siz);
2148 }
2149 // draw YAW bar
2151 hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialYaw]);
2152}

◆ drawYellowSurround:

- (void) drawYellowSurround: (NSDictionary *) info

Extends class HeadUpDisplay.

Definition at line 2541 of file HeadUpDisplay.m.

3324 :(NSDictionary *)info
3325{
3326 [self drawSurroundInternal:info color:yellow_color];
3327}

◆ resetGui:withInfo:

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

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

363 :(GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info
364{
365 [self resetGuiPosition:gui withInfo:gui_info];
366
367 NSSize siz = [gui size];
368 int rht = [gui rowHeight];
369 NSString* title = [gui title];
370 if ([gui_info objectForKey:WIDTH_KEY])
371 siz.width = [gui_info oo_floatForKey:WIDTH_KEY];
372 if ([gui_info objectForKey:HEIGHT_KEY])
373 siz.height = [gui_info oo_floatForKey:HEIGHT_KEY];
374 if ([gui_info objectForKey:ROW_HEIGHT_KEY])
375 rht = [gui_info oo_floatForKey:ROW_HEIGHT_KEY];
376 if ([gui_info objectForKey:TITLE_KEY])
377 title = [gui_info oo_stringForKey:TITLE_KEY];
378 [gui resizeTo:siz characterHeight:rht title:title];
379 if ([gui_info objectForKey:BACKGROUND_RGBA_KEY])
380 [gui setBackgroundColor:[OOColor colorFromString:[gui_info oo_stringForKey:BACKGROUND_RGBA_KEY]]];
381 if ([gui_info objectForKey:ALPHA_KEY])
382 [gui setMaxAlpha: OOClamp_0_max_f([gui_info oo_floatForKey:ALPHA_KEY],1.0f)];
383 else
384 [gui setMaxAlpha: 1.0f];
385}
#define ROW_HEIGHT_KEY
#define HEIGHT_KEY
#define WIDTH_KEY
#define TITLE_KEY
#define BACKGROUND_RGBA_KEY
#define ALPHA_KEY
void resizeTo:characterHeight:title:(NSSize gui_size,[characterHeight] int csize,[title] NSString *gui_title)
void setMaxAlpha:(GLfloat an_alpha)
NSString * title
unsigned rowHeight()

◆ resetGuiPosition:withInfo:

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

Extends class HeadUpDisplay.

Definition at line 214 of file HeadUpDisplay.m.

388 :(GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info
389{
390 Vector pos = [gui drawPosition];
391 if ([gui_info objectForKey:X_KEY])
392 pos.x = [gui_info oo_floatForKey:X_KEY] +
393 [[UNIVERSE gameView] x_offset] *
394 [gui_info oo_floatForKey:X_ORIGIN_KEY defaultValue:0.0];
395 if ([gui_info objectForKey:Y_KEY])
396 pos.y = [gui_info oo_floatForKey:Y_KEY] +
397 [[UNIVERSE gameView] y_offset] *
398 [gui_info oo_floatForKey:Y_ORIGIN_KEY defaultValue:0.0];
399
400 [gui setDrawPosition:pos];
401}
#define X_ORIGIN_KEY
#define Y_ORIGIN_KEY
#define X_KEY
#define Y_KEY

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