34#import "OOJavaScriptEngine.h"
52#define ONE_SIXTEENTH 0.0625
53#define ONE_SIXTYFOURTH 0.015625
54#define DEFAULT_OVERALL_ALPHA 0.75
55#define GLYPH_SCALE_FACTOR 0.13
56#define IDENTIFY_SCANNER_LOLLIPOPS (0 && OOLITE_DEBUG)
58#define NOT_DEFINED INFINITY
61#define WIDGET_SELECTOR 2
62#define WIDGET_SELECTOR_NAME 3
65#define DO_SET_COLOR(t, d) SetGLColourFromInfo(info, t, d, alpha)
66#define SET_COLOR(d) DO_SET_COLOR(COLOR_KEY, d)
67#define SET_COLOR_LOW(d) DO_SET_COLOR(COLOR_KEY_LOW, d)
68#define SET_COLOR_MEDIUM(d) DO_SET_COLOR(COLOR_KEY_MEDIUM, d)
69#define SET_COLOR_HIGH(d) DO_SET_COLOR(COLOR_KEY_HIGH, d)
70#define SET_COLOR_CRITICAL(d) DO_SET_COLOR(COLOR_KEY_CRITICAL, d)
71#define SET_COLOR_SURROUND(d) DO_SET_COLOR(COLOR_KEY_SURROUND, d)
85static void DrawSpecialOval(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat step, GLfloat* color4v);
87static void SetGLColourFromInfo(NSDictionary* info, NSString* key,
const GLfloat defaultColor[4], GLfloat alpha);
92static void hudDrawBarAt(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat amount);
96 GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary* propertiesReticleTargetSensitive,
97 BOOL colourFromScannerColour, BOOL showText, NSDictionary* info, NSMutableArray* reticleColors);
100static void drawScannerGrid(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz,
int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic);
112@interface HeadUpDisplay (Private)
119- (void)drawLegend:(NSDictionary*)info;
120- (void)drawHUDItem:(NSDictionary*)info;
122- (void)drawScanner:(NSDictionary*)info;
123- (void)drawScannerZoomIndicator:(NSDictionary*)info;
125- (void)drawCompass:(NSDictionary*)info;
126- (void)drawCompassPlanetBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha;
127- (void)drawCompassStationBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha;
128- (void)drawCompassSunBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha;
129- (void)drawCompassTargetBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha;
130- (void)drawCompassBeaconBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha;
132- (void)drawAegis:(NSDictionary*)info;
133- (void)drawSpeedBar:(NSDictionary*)info;
134- (void)drawRollBar:(NSDictionary*)info;
135- (void)drawPitchBar:(NSDictionary*)info;
136- (void)drawYawBar:(NSDictionary*)info;
137- (void)drawEnergyGauge:(NSDictionary*)info;
138- (void)drawForwardShieldBar:(NSDictionary*)info;
139- (void)drawAftShieldBar:(NSDictionary*)info;
140- (void)drawFuelBar:(NSDictionary*)info;
141- (void)drawWitchspaceDestination:(NSDictionary*)info;
142- (void)drawCabinTempBar:(NSDictionary*)info;
143- (void)drawWeaponTempBar:(NSDictionary*)info;
144- (void)drawAltitudeBar:(NSDictionary*)info;
145- (void)drawMissileDisplay:(NSDictionary*)info;
146- (void)drawTargetReticle:(NSDictionary*)info;
147- (void)drawSecondaryTargetReticle:(NSDictionary*)info;
148- (void)drawWaypoints:(NSDictionary*)info;
149- (void)drawStatusLight:(NSDictionary*)info;
150- (void)drawDirectionCue:(NSDictionary*)info;
151- (void)drawClock:(NSDictionary*)info;
152- (void)drawPrimedEquipmentText:(NSDictionary*)info;
153- (void)drawASCTarget:(NSDictionary*)info;
154- (void)drawWeaponsOfflineText:(NSDictionary*)info;
155- (void)drawMultiFunctionDisplay:(NSDictionary*)info withText:(NSString*)text asIndex:(NSUInteger)index;
156- (void)drawFPSInfoCounter:(NSDictionary*)info;
157- (void)drawScoopStatus:(NSDictionary*)info;
158- (void)drawStickSensitivityIndicator:(NSDictionary*)info;
159- (void)drawCustomBar:(NSDictionary*)info;
160- (void)drawCustomText:(NSDictionary*)info;
161- (void)drawCustomIndicator:(NSDictionary*)info;
162- (void)drawCustomLight:(NSDictionary*)info;
163- (void)drawCustomImage:(NSDictionary*)info;
165- (void)drawSurroundInternal:(NSDictionary*)info color:(const GLfloat[4])color;
166- (void)drawSurround:(NSDictionary*)info;
167- (void)drawGreenSurround:(NSDictionary*)info;
168- (void)drawYellowSurround:(NSDictionary*)info;
170- (void)drawTrumbles:(NSDictionary*)info;
172- (NSArray*)crosshairDefinitionForWeaponType:(
OOWeaponType)weapon;
177- (void)resetGui:(
GuiDisplayGen*)gui withInfo:(NSDictionary*)gui_info;
178- (void)resetGuiPosition:(
GuiDisplayGen*)gui withInfo:(NSDictionary*)gui_info;
184static const GLfloat
red_color[4] = { 1.0, 0.0, 0.0, 1.0 };
198static GLfloat drawCharacterQuad(uint8_t chr, GLfloat
x, GLfloat
y, GLfloat z, NSSize siz);
200static void InitTextEngine(
void);
207 glColor4f(color[0], color[1], color[2], color[3] * alpha);
210- (id)initWithDictionary:(NSDictionary*)hudinfo
215- (id)initWithDictionary:(NSDictionary*)hudinfo inFile:(NSString*)hudFileName
218 BOOL isCompassToBeDrawn = NO;
219 BOOL areTrumblesToBeDrawn = NO;
239 NSArray* dials = [
hudinfo oo_arrayForKey:DIALS_KEY];
240 for (i = 0; i < [
dials count]; i++) {
241 NSDictionary* dial_info = [
dials oo_dictionaryAtIndex:i];
242 if (!areTrumblesToBeDrawn && [[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawTrumbles:"])
243 areTrumblesToBeDrawn = YES;
244 if (!isCompassToBeDrawn && [[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawCompass:"])
245 isCompassToBeDrawn = YES;
246 if ([[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawTargetReticle:"]) {
260 if (!areTrumblesToBeDrawn)
262 NSDictionary* trumble_dial_info = [
NSDictionary dictionaryWithObjectsAndKeys:@"drawTrumbles:", SELECTOR_KEY, nil];
263 [
self addDial:trumble_dial_info];
270 NSArray* legends = [
hudinfo oo_arrayForKey:LEGENDS_KEY];
271 for (i = 0; i < [
legends count]; i++) {
275 NSArray* mfds = [
hudinfo oo_arrayForKey:MFDS_KEY];
276 for (i = 0; i < [
mfds count]; i++) {
286 overallAlpha = [
hudinfo oo_floatForKey:@"overall_alpha" defaultValue:DEFAULT_OVERALL_ALPHA];
290 [
NSNumber numberWithBool:YES], @"isAccurate",
291 [
NSNumber numberWithDouble:[UNIVERSE getTime]], @"timeLastAccuracyProbabilityCalculation",
300 [crosshairDefinition release];
302 NSString* crossfile = [[
hudinfo oo_stringForKey:@"crosshair_file"] retain];
303 if (crossfile ==
nil) {
311 id crosshairColor = [
hudinfo oo_objectForKey:@"crosshair_color" defaultValue:@"greenColor"];
353 siz.width = [
gui_info oo_floatForKey:WIDTH_KEY];
355 siz.height = [
gui_info oo_floatForKey:HEIGHT_KEY];
357 rht = [
gui_info oo_floatForKey:ROW_HEIGHT_KEY];
359 title = [
gui_info oo_stringForKey:TITLE_KEY];
369- (void)resetGuiPosition:(
GuiDisplayGen*)gui withInfo:(NSDictionary*)gui_info
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
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
386- (void)resetGuis:(NSDictionary*)info
392 NSDictionary* gui_info = [
info oo_dictionaryForKey:@"message_gui"];
393 if (gui && [gui_info
count] > 0) {
403 BOOL line1 = ![[
lastLines oo_stringAtIndex:0] isEqualToString:@""];
406 BOOL permanent = [
gui_info oo_boolForKey:@"permanent" defaultValue:NO];
407 [UNIVERSE setPermanentMessageLog:permanent];
409 BOOL automaticBg = [
gui_info oo_boolForKey:@"background_automatic" defaultValue:YES];
410 [UNIVERSE setAutoMessageLogBg:automaticBg];
423 align:GUI_ALIGN_CENTER
425 fadeTime:(permanent ? 0.0 : [
lastLines oo_floatAtIndex:2])key:nil
428 if ([lastLines
count] > 3 && (line1 || ![[lastLines oo_stringAtIndex:3] isEqualToString:
@""])) {
430 align:GUI_ALIGN_CENTER
432 fadeTime:(permanent ? 0.0 : [
lastLines oo_floatAtIndex:5])key:nil
437 if (gui_info !=
nil && [gui_info
count] == 0) {
445 [UNIVERSE setPermanentMessageLog:NO];
446 [UNIVERSE setAutoMessageLogBg:YES];
453 gui = [UNIVERSE commLogGUI];
454 gui_info = [
info oo_dictionaryForKey:@"comm_log_gui"];
456 if (gui && [gui_info
count] > 0) {
457 [UNIVERSE setAutoCommLog:[
gui_info oo_boolForKey:@"automatic" defaultValue:YES]];
458 [UNIVERSE setPermanentCommLog:[
gui_info oo_boolForKey:@"permanent" defaultValue:NO]];
473 NSArray* cLog = [PLAYER commLog];
474 NSUInteger i, commCount = [
cLog count];
478 for (i = 0; i < commCount; i++) {
488 if (gui_info !=
nil && [gui_info
count] == 0) {
490 [UNIVERSE setAutoCommLog:YES];
491 [UNIVERSE setPermanentCommLog:NO];
513- (void)setHudName:(NSString*)newHudName
515 if (newHudName !=
nil) {
521- (
OOColor*)reticleColorForIndex:(NSUInteger)idx
524 return [_reticleColors objectAtIndex:idx];
529- (BOOL)setReticleColorForIndex:(NSUInteger)idx toColor:(
OOColor*)newColor
532 [_reticleColors replaceObjectAtIndex:idx withObject:newColor];
543- (void)setScannerZoom:(GLfloat)value
553- (void)setOverallAlpha:(GLfloat)newAlphaValue
563- (void)setReticleTargetSensitive:(BOOL)newReticleTargetSensitiveValue
578- (void)setHidden:(BOOL)newValue
588- (BOOL)hasHidden:(NSString*)selectorName
590 if (selectorName ==
nil) {
593 return [_hiddenSelectors containsObject:selectorName];
596- (void)setHiddenSelector:(NSString*)selectorName hidden:(BOOL)hide
599 [_hiddenSelectors addObject:selectorName];
601 [_hiddenSelectors removeObject:selectorName];
607 [_hiddenSelectors removeAllObjects];
615- (void)setCompassActive:(BOOL)newValue
625- (void)setDeferredHudName:(NSString*)newDeferredHudName
627 [deferredHudName release];
636- (void)addLegend:(NSDictionary*)info
638 NSString* imageName =
nil;
642 NSMutableDictionary* legendDict =
nil;
648 imageName = [
info oo_stringForKey:IMAGE_KEY];
649 if (imageName !=
nil) {
652 options:kOOTextureDefaultOptions | kOOTextureNoShrink
654 lodBias:kOOTextureDefaultLODBias];
655 if (texture ==
nil) {
661 imageSize.width = [
info oo_floatForKey:WIDTH_KEY defaultValue:imageSize.width];
662 imageSize.height = [
info oo_floatForKey:HEIGHT_KEY defaultValue:imageSize.height];
664 legendSprite = [[
OOTextureSprite alloc] initWithTexture:texture size:imageSize];
666 legendDict = [
info mutableCopy];
667 [
legendDict setObject:legendSprite forKey:SPRITE_KEY];
669 [legendArray addObject:[
NSArray arrayWithObjects:legendDict, [
NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
672 }
else if ([info oo_stringForKey:
TEXT_KEY] !=
nil) {
674 [legendArray addObject:[
NSArray arrayWithObjects:info, [
NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
678- (void)addDial:(NSDictionary*)info
680 static NSSet* allowedSelectors =
nil;
681 if (allowedSelectors ==
nil) {
683 allowedSelectors = [[
NSSet alloc] initWithArray:[
whitelist oo_arrayForKey:@"hud_dial_methods"]];
686 NSString* selectorString = [
info oo_stringForKey:SELECTOR_KEY];
687 if (selectorString ==
nil) {
688 OOLogERR(
@"hud.dial.noSelector",
@"HUD dial in %@ is missing selector.",
hudName);
692 if (![allowedSelectors containsObject:selectorString]) {
693 OOLogERR(
@"hud.dial.invalidSelector",
@"HUD dial in %@ uses selector \"%@\
" which is not in whitelist, and will be ignored.",
hudName, selectorString);
697 SEL selector = NSSelectorFromString(selectorString);
699 NSAssert2([
self respondsToSelector:selector],
@"HUD dial in %@ uses selector \"%@\
" which is in whitelist, but not implemented.",
hudName, selectorString);
702 if (![
self respondsToSelector:selector]) {
703 OOLogERR(
@"hud.dial.invalidSelector",
@"HUD dial in %@ uses selector \"%@\
" which is in whitelist, but not implemented, and will be ignored.",
hudName, selectorString);
711 [dialArray addObject:[
NSArray arrayWithObjects:info, [
NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)],
712 [
NSValue valueWithPointer:selector], selectorString, nil]];
715- (void)addMFD:(NSDictionary*)info
719 [mfdArray addObject:[
NSArray arrayWithObjects:info, [
NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
724 return [mfdArray count];
784 z1 = [[UNIVERSE gameView] display_z];
786 for (i = 0; i < nLegends; i++) {
788 [
self drawLegend:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
794 z1 = [[UNIVERSE gameView] display_z];
799 NSUInteger i, nDials = [
dialArray count];
800 for (i = 0; i < nDials; i++) {
802 [
self drawHUDItem:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
809 [PLAYER doScriptEvent:OOJSID("compassTargetChanged") withArguments:[
NSArray arrayWithObjects:[
NSNull null], OOStringFromCompassMode([PLAYER compassMode]), nil]];
815 NSUInteger i, nMFDs = [
mfdArray count];
816 NSString* text =
nil;
817 for (i = 0; i < nMFDs; i++) {
818 text = [PLAYER multiFunctionText:i];
828 OOViewID viewID = [UNIVERSE viewDirection];
830 BOOL weaponsOnline = [PLAYER weaponsOnline];
831 NSArray* points =
nil;
833 if (viewID == VIEW_CUSTOM || overallAlpha == 0.0f || !([
PLAYER status] == STATUS_IN_FLIGHT || [
PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
839 if (weapon != _lastWeaponType || overallAlpha != _lastOverallAlpha || weaponsOnline != _lastWeaponsOnline) {
843 if (_crosshairs ==
nil) {
844 GLfloat useAlpha = weaponsOnline ? overallAlpha : overallAlpha * 0.5f;
849 _crosshairs = [[
OOCrosshairs alloc] initWithPoints:points
850 scale:_crosshairScale
851 color:_crosshairColor
852 overallAlpha:useAlpha];
853 _lastWeaponType = weapon;
854 _lastOverallAlpha = useAlpha;
855 _lastWeaponsOnline = weaponsOnline;
866- (BOOL)setCrosshairDefinition:(NSString*)newDefinition
872 [_crosshairOverrides release];
877 [_crosshairOverrides release];
890 NSString* weaponName =
nil;
891 NSString* weaponName2 =
nil;
892 static NSDictionary* crosshairDefs =
nil;
893 NSArray* result =
nil;
903 weaponName2 = [
weaponName substringFromIndex:3];
911 if (crosshairDefs ==
nil) {
929- (void)drawLegend:(NSDictionary*)info
932 NSString* equipmentRequired = [
info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
933 if (equipmentRequired !=
nil && ![
PLAYER hasEquipmentItemProviding:equipmentRequired]) {
938 NSUInteger alertMask = [
info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
940 if (alertMask < 15) {
942 if (~alertMask & (1 << alertCondition)) {
947 BOOL viewOnly = [
info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
949 if (viewOnly && [
PLAYER guiScreen] != GUI_SCREEN_MAIN) {
959 NSString* legendText =
nil;
962 GLfloat alpha = overallAlpha;
965 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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;
973 legendSprite = [
info objectForKey:SPRITE_KEY];
974 if (legendSprite !=
nil) {
977 legendText = [
info oo_stringForKey:TEXT_KEY];
978 if (legendText !=
nil) {
983 if ([info oo_intForKey:
@"align"] == 1) {
992- (void)drawHUDItem:(NSDictionary*)info
994 NSString* equipment = [
info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
996 if (equipment !=
nil && ![
PLAYER hasEquipmentItemProviding:equipment]) {
1001 NSUInteger alertMask = [
info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1003 if (alertMask < 15) {
1005 if (~alertMask & (1 << alertCondition)) {
1010 BOOL viewOnly = [
info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1013 if (viewOnly && [
PLAYER guiScreen] != GUI_SCREEN_MAIN) {
1022 [
self performSelector:[(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR] pointerValue] withObject:info];
1030 return [PLAYER isInSpace] && [PLAYER status] != STATUS_DOCKING;
1036 OOPlanetEntity* the_planet = [UNIVERSE planet];
1039 && the_sun && the_planet
1045 data->
x = [
info oo_floatForKey:X_KEY defaultValue:NOT_DEFINED];
1046 data->
x0 = [
info oo_floatForKey:X_ORIGIN_KEY defaultValue:0.0];
1047 data->
y = [
info oo_floatForKey:Y_KEY defaultValue:NOT_DEFINED];
1048 data->
y0 = [
info oo_floatForKey:Y_ORIGIN_KEY defaultValue:0.0];
1049 data->
width = [
info oo_floatForKey:WIDTH_KEY defaultValue:NOT_DEFINED];
1050 data->
height = [
info oo_floatForKey:HEIGHT_KEY defaultValue:NOT_DEFINED];
1051 data->
alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f];
1056- (void)drawScanner:(NSDictionary*)info
1060 GLfloat scanner_color[4] = { 1.0, 0.0, 0.0, 1.0 };
1062 BOOL emptyDial = ([
info oo_floatForKey:ALPHA_KEY] == 0.0f);
1064 BOOL isHostile = NO;
1066 BOOL inColorBlindMode = [UNIVERSE colorblindMode] !=
OO_POSTFX_NONE;
1071 scanner_color[3] = 0.0;
1072 siz = NSMakeSize(1.0, 1.0);
1076 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1085 scanner_color[3] *= overallAlpha;
1088 GLfloat alpha = scanner_color[3];
1089 GLfloat col[4] = { 1.0, 1.0, 1.0, alpha };
1091 GLfloat z_factor = siz.height / siz.width;
1092 GLfloat y_factor = 1.0 - sqrt(z_factor);
1099 GLfloat zoom = scanner_zoom;
1100 if (scanner_ultra_zoom)
1101 zoom = pow(2, zoom - 1.0);
1103 if (!nonlinear_scanner) {
1104 max_zoomed_range2 /= zoom * zoom;
1106 GLfloat max_zoomed_range = sqrt(max_zoomed_range2);
1111 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1113 int flash = ((
int)([UNIVERSE getTime] * 4)) & 1;
1116 int ent_count =
UNIVERSE->n_entities;
1121 for (i = 0; i < ent_count; i++) {
1126 OOGL(glColor4fv(scanner_color));
1131 GLfloat upscale = zoom * 1.25 / scannerFootprint;
1132 GLfloat max_blip = 0.0;
1148 for (i = 0; i < ent_count; i++)
1150 scannedEntity = my_entities[
i];
1155 if (
EXPECT_NOT(drawClass == CLASS_PLAYER || ([scannedEntity isShip] && [(
ShipEntity*)scannedEntity isCloaked]))) {
1156 drawClass = CLASS_NO_DRAW;
1159 if (drawClass != CLASS_NO_DRAW) {
1161 float ms_blip = 0.0;
1174 if (act_dist > max_zoomed_range + 10000.0)
1177 if (lim_dist > max_zoomed_range)
1182 if ([scannedEntity isShip])
1184 if (ms_blip > max_blip) {
1188 ms_blip -= floor(ms_blip);
1190 relativePosition = [PLAYER vectorTo:scannedEntity];
1191 double fuzz = [PLAYER scannerFuzziness];
1192 if (fuzz > 0 && ![[
UNIVERSE gameController] isGamePaused]) {
1196 Vector rp = relativePosition;
1198 if (act_dist > max_zoomed_range)
1199 scale_vector(&relativePosition, max_zoomed_range / act_dist);
1203 Vector rrp = relativePosition;
1205 if (nonlinear_scanner) {
1211 x1 = relativePosition.
x;
1212 y1 = z_factor * relativePosition.
z;
1213 y2 = y1 + y_factor * relativePosition.
y;
1216 if ([scannedEntity isShip]) {
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]) {
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];
1239 if ([scannedEntity isWormhole]) {
1251 if ([scannedEntity isShip]) {
1264 bounds[4] = ship->
v_up;
1266 bounds[5] = ship->
v_up;
1270 for (i = 0; i < 6; i++) {
1272 if (nonlinear_scanner) {
1277 bounds[
i] =
make_vector(bounds[i].
x + scanner_cx, bounds[i].z * z_factor + bounds[i].
y * y_factor + scanner_cy, z1);
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);
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);
1302 if ([scannedEntity isCascadeWeapon]) {
1303 if (nonlinear_scanner) {
1307 GLfloat l2 = r1 * r1 - relativePosition.
y * relativePosition.
y;
1308 GLfloat r0 = (l2 > 0) ? sqrt(l2) : 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);
1313 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
1318#if IDENTIFY_SCANNER_LOLLIPOPS
1319 if ([scannedEntity isShip]) {
1320 glColor4f(1.0, 1.0, 0.5, alpha);
1325 if (inColorBlindMode && isHostile) {
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);
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);
1344 glVertex3f(x1, y1, z1);
1345 glVertex3f(x1 + 2, y1, z1);
1346 glVertex3f(x1 + 2, y2, z1);
1347 glVertex3f(x1, y2, z1);
1354 for (i = 0; i < ent_count; i++) {
1366- (void)setMinimalisticScanner:(BOOL)newValue
1371+ (
Vector)nonlinearScannerScale:(
Vector)V Zoom:(GLfloat)zoom Scale:(
double)scale
1383- (void)setNonlinearScanner:(BOOL)newValue
1393- (void)setScannerUltraZoom:(BOOL)newValue
1400 Entity* lt = [UNIVERSE entityForUniversalID:last_transmitter];
1404 if ([st messageTime] <= 0.0)
1408- (void)drawScannerZoomIndicator:(NSDictionary*)info
1413 GLfloat zoom_color[4] = { 1.0f, 0.1f, 0.0f, 1.0f };
1416 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1424 zoom_color[3] *= overallAlpha;
1425 alpha = zoom_color[3];
1427 GLfloat cx =
x - 0.3 * siz.width;
1428 GLfloat cy =
y - 0.75 * siz.height;
1430 int zl = scanner_zoom;
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));
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);
1452 OOGL(glDisable(GL_TEXTURE_2D));
1455- (void)drawCompass:(NSDictionary*)info
1460 GLfloat compass_color[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
1463 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1471 compass_color[3] *= overallAlpha;
1472 alpha = compass_color[3];
1475 OOMatrix rotMatrix = [PLAYER rotationMatrix];
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;
1482 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], alpha));
1484 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], 0.5f * alpha));
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);
1499 Entity* reference = [PLAYER compassTarget];
1503 Vector relativePosition = [PLAYER vectorTo:reference];
1507 relativePosition.
x *= siz.width * 0.4;
1508 relativePosition.
y *= siz.height * 0.4;
1509 relativePosition.
x +=
x;
1510 relativePosition.
y +=
y;
1515 switch ([
PLAYER compassMode]) {
1516 case COMPASS_MODE_INACTIVE:
1519 case COMPASS_MODE_BASIC:
1520 if ([reference isStation])
1526 case COMPASS_MODE_PLANET:
1530 case COMPASS_MODE_STATION:
1534 case COMPASS_MODE_SUN:
1538 case COMPASS_MODE_TARGET:
1542 case COMPASS_MODE_BEACONS:
1545 [[
beacon beaconDrawable] oo_drawHUDBeaconIconAt:NSMakePoint(x, y) size:siz alpha:alpha z:z1];
1551 _compassActive = YES;
1557 if (relativeZ >= 0.0f) {
1558 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1560 OOGL(glColor4f(1.0f, 0.0f, 0.0f, alpha));
1564- (void)drawCompassPlanetBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1566 if (relativePosition.
z >= 0) {
1567 OOGL(glColor4f(0.0, 1.0, 0.0, 0.75 * alpha));
1569 OOGL(glColor4f(0.0, 1.0, 0.0, alpha));
1570 GLDrawOval(relativePosition.
x, relativePosition.
y, z1, siz, 30);
1572 OOGL(glColor4f(1.0, 0.0, 0.0, alpha));
1573 GLDrawOval(relativePosition.
x, relativePosition.
y, z1, siz, 30);
1577- (void)drawCompassStationBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1579 SetCompassBlipColor(relativePosition.
z, alpha);
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);
1589- (void)drawCompassSunBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1591 OOGL(glColor4f(1.0, 1.0, 0.0, 0.75 * alpha));
1594 SetCompassBlipColor(relativePosition.
z, alpha);
1596 GLDrawOval(relativePosition.
x, relativePosition.
y, z1, siz, 30);
1599- (void)drawCompassTargetBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1601 SetCompassBlipColor(relativePosition.
z, alpha);
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);
1610 GLDrawOval(relativePosition.
x, relativePosition.
y, z1, siz, 30);
1613- (void)drawCompassBeaconBlipAt:(
Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1615 SetCompassBlipColor(relativePosition.
z, alpha);
1626 glVertex3f(relativePosition.
x + 0.6 * siz.width, relativePosition.
y, z1);
1627 glVertex3f(relativePosition.
x, relativePosition.
y + 0.6 * siz.height, z1);
1629 glVertex3f(relativePosition.
x - 0.6 * siz.width, relativePosition.
y, z1);
1630 glVertex3f(relativePosition.
x, relativePosition.
y + 0.6 * siz.height, z1);
1632 glVertex3f(relativePosition.
x + 0.6 * siz.width, relativePosition.
y, z1);
1633 glVertex3f(relativePosition.
x, relativePosition.
y - 0.6 * siz.height, z1);
1635 glVertex3f(relativePosition.
x - 0.6 * siz.width, relativePosition.
y, z1);
1636 glVertex3f(relativePosition.
x, relativePosition.
y - 0.6 * siz.height, z1);
1641- (void)drawAegis:(NSDictionary*)info
1648 GLfloat alpha = 0.5f * overallAlpha;
1651 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1657 alpha *= cached.
alpha;
1661 GLfloat w = siz.width / 16.0;
1662 GLfloat h = siz.height / 16.0;
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 };
1667 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1670 for (i = 0; i < 32; i += 2) {
1671 glVertex3f(
x + w * strip[i],
y - h * strip[i + 1], z1);
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));
1684 OOGL(glDrawArrays(GL_QUAD_STRIP, 0,
sizeof strip /
sizeof *strip / 2));
1685 OOGL(glDisableClientState(GL_VERTEX_ARRAY));
1691- (void)drawCustomBar:(NSDictionary*)info
1696 GLfloat alpha = overallAlpha;
1700 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1702 x =
useDefined(cached.
x, 0) + [[UNIVERSE gameView] x_offset] * cached.
x0;
1703 y =
useDefined(cached.
y, 0) + [[UNIVERSE gameView] y_offset] * cached.
y0;
1706 alpha *= cached.
alpha;
1708 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1711 if (draw_surround) {
1718 }
else if (ds > .25) {
1727- (void)drawCustomText:(NSDictionary*)info
1731 GLfloat alpha = overallAlpha;
1732 NSString* text = [PLAYER dialCustomString:[
info oo_stringForKey:CUSTOM_DIAL_KEY]];
1735 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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;
1746 if ([info oo_intForKey:
@"align"] == 1) {
1753- (void)drawCustomIndicator:(NSDictionary*)info
1758 GLfloat alpha = overallAlpha;
1763 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1765 x =
useDefined(cached.
x, 0) + [[UNIVERSE gameView] x_offset] * cached.
x0;
1766 y =
useDefined(cached.
y, 0) + [[UNIVERSE gameView] y_offset] * cached.
y0;
1769 alpha *= cached.
alpha;
1770 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1772 if (draw_surround) {
1782- (void)drawCustomLight:(NSDictionary*)info
1786 GLfloat alpha = overallAlpha;
1790 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1792 x =
useDefined(cached.
x, 0) + [[UNIVERSE gameView] x_offset] * cached.
x0;
1793 y =
useDefined(cached.
y, 0) + [[UNIVERSE gameView] y_offset] * cached.
y0;
1796 alpha *= cached.
alpha;
1798 GLfloat light_color[4] = { 0.25, 0.25, 0.25, 0.0 };
1800 OOColor* color = [PLAYER dialCustomColor:[
info oo_stringForKey:CUSTOM_DIAL_KEY]];
1802 green:&light_color[1]
1803 blue:&light_color[2]
1804 alpha:&light_color[3]];
1806 GLColorWithOverallAlpha(light_color, alpha);
1810 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
1816- (void)drawCustomImage:(NSDictionary*)info
1819 GLfloat alpha = overallAlpha;
1823 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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;
1829 NSString* textureFile = [PLAYER dialCustomString:[
info oo_stringForKey:CUSTOM_DIAL_KEY]];
1830 if (textureFile ==
nil || [textureFile length] == 0) {
1836 options:kOOTextureDefaultOptions | kOOTextureNoShrink
1838 lodBias:kOOTextureDefaultLODBias];
1839 if (texture ==
nil) {
1859- (void)drawSpeedBar:(NSDictionary*)info
1864 GLfloat alpha = overallAlpha;
1865 GLfloat ds = [PLAYER dialSpeed];
1868 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1874 alpha *= cached.
alpha;
1876 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:SPEED_BAR_DRAW_SURROUND];
1879 if (draw_surround) {
1886 }
else if (ds > .25) {
1895- (void)drawRollBar:(NSDictionary*)info
1900 GLfloat alpha = overallAlpha;
1903 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1909 alpha *= cached.
alpha;
1910 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ROLL_BAR_DRAW_SURROUND];
1912 if (draw_surround) {
1922- (void)drawPitchBar:(NSDictionary*)info
1927 GLfloat alpha = overallAlpha;
1930 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1936 alpha *= cached.
alpha;
1937 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
1939 if (draw_surround) {
1949- (void)drawYawBar:(NSDictionary*)info
1954 GLfloat alpha = overallAlpha;
1957 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1964 alpha *= cached.
alpha;
1965 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
1967 if (draw_surround) {
1977- (void)drawEnergyGauge:(NSDictionary*)info
1982 BOOL drawSurround, labelled, energyCritical = NO;
1983 GLfloat alpha = overallAlpha;
1984 GLfloat bankHeight, bankY;
1988 n_bars = [
info oo_unsignedIntForKey:N_BARS_KEY defaultValue:n_bars];
1995 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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];
2013 bankHeight = siz.height / n_bars;
2015 NSSize barSize = NSMakeSize(siz.width, bankHeight - 2.0);
2016 GLfloat midBank = bankHeight / 2.0f;
2017 bankY =
y - (n_bars - 1) * midBank - 1.0;
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;
2030 if (energyCritical) {
2035 bankY =
y - (n_bars - 1) * midBank;
2036 for (i = 0; i < n_bars; i++) {
2039 }
else if (energy > 0.0) {
2044 bankY += bankHeight;
2048- (void)drawForwardShieldBar:(NSDictionary*)info
2053 GLfloat alpha = overallAlpha;
2054 GLfloat shield = [PLAYER dialForwardShield];
2057 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2063 alpha *= cached.
alpha;
2064 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:FORWARD_SHIELD_BAR_DRAW_SURROUND];
2066 if (draw_surround) {
2074 }
else if (shield < .80) {
2082- (void)drawAftShieldBar:(NSDictionary*)info
2087 GLfloat alpha = overallAlpha;
2088 GLfloat shield = [PLAYER dialAftShield];
2091 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2097 alpha *= cached.
alpha;
2098 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:AFT_SHIELD_BAR_DRAW_SURROUND];
2100 if (draw_surround) {
2108 }
else if (shield < .80) {
2116- (void)drawFuelBar:(NSDictionary*)info
2122 GLfloat alpha = overallAlpha;
2125 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2131 alpha *= cached.
alpha;
2132 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2134 if (draw_surround) {
2139 fu = [PLAYER dialFuel];
2140 hr = [PLAYER dialHyperRange];
2147 if (hr > 0.0f && hr <= 1.0f) {
2148 if ([
PLAYER hasSufficientFuelForJump]) {
2157- (void)drawWitchspaceDestination:(NSDictionary*)info
2160 if ([
PLAYER dialHyperRange] == 0.0f) {
2166 GLfloat alpha = overallAlpha;
2170 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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];
2180 dest =
DESC(
@"status-unknown-system");
2184 if ([info oo_intForKey:
@"align"] == 1) {
2191- (void)drawCabinTempBar:(NSDictionary*)info
2196 GLfloat temp = [PLAYER hullHeatLevel];
2197 GLfloat alpha = overallAlpha;
2200 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2206 alpha *= cached.
alpha;
2207 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2209 if (draw_surround) {
2218 if (temp > .90 && flash)
2232- (void)drawWeaponTempBar:(NSDictionary*)info
2237 GLfloat temp = [PLAYER laserHeatLevel];
2238 GLfloat alpha = overallAlpha;
2241 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2247 alpha *= cached.
alpha;
2248 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2250 if (draw_surround) {
2258 else if (temp > .25)
2265- (void)drawAltitudeBar:(NSDictionary*)info
2270 GLfloat alt = [PLAYER dialAltitude];
2271 GLfloat alpha = overallAlpha;
2274 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2280 alpha *= cached.
alpha;
2281 draw_surround = [
info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2283 if (draw_surround) {
2293 if (alt < .10 && flash)
2313 static NSMutableDictionary* sIcons =
nil;
2316 result = [
sIcons objectForKey:role];
2317 if (result ==
nil) {
2318 NSString* key = role;
2319 NSArray* iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2321 result = [[
OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2331 if ([role hasSuffix:
@"_MISSILE"])
2336 iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2337 result = [[
OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2340 if (result !=
nil) {
2343 [
sIcons setObject:result forKey:role];
2352 selected:(BOOL)selected
2356 width:(GLfloat)width
2357 height:(GLfloat)height
2358 alpha:(GLfloat)alpha
2391 if ([missile primaryTarget] ==
nil)
2404- (void)drawIconForEmptyPylonAtX:(
int)x y:(
int)y
2405 width:(GLfloat)width
2406 height:(GLfloat)height
2407 alpha:(GLfloat)alpha
2420- (void)drawMissileDisplay:(NSDictionary*)info
2424 GLfloat alpha = overallAlpha;
2427 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2433 alpha *= cached.
alpha;
2434 sp = [
info oo_unsignedIntForKey:SPACING_KEY defaultValue:MISSILES_DISPLAY_SPACING];
2436 BOOL weaponsOnline = [PLAYER weaponsOnline];
2440 if (![
PLAYER dialIdentEngaged]) {
2442 NSUInteger i, n_mis = [PLAYER dialMaxMissiles];
2443 for (i = 0; i < n_mis; i++) {
2444 ShipEntity* missile = [PLAYER missileForPylon:i];
2447 selected:weaponsOnline && i == [PLAYER activeMissile]
2449 x:x + (int)i * sp + 2
2451 width:siz.width * 0.25f
2452 height:siz.height * 0.25f
2457 width:siz.width * 0.25f
2458 height:siz.height * 0.25f
2464 y -= siz.height * 0.75;
2467 switch ([
PLAYER dialMissileStatus]) {
2475 GLColorWithOverallAlpha(
red_color, alpha);
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);
2489- (void)drawTargetReticle:(NSDictionary*)info
2491 GLfloat alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2498 if ([
PLAYER hasEquipmentItemProviding:
@"EQ_INTEGRATED_TARGETING_SYSTEM"]) {
2503- (void)drawSecondaryTargetReticle:(NSDictionary*)info
2505 GLfloat alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha * 0.4;
2508 if ([player hasEquipmentItemProviding:
@"EQ_TARGET_MEMORY"]) {
2520 if (sec_id !=
nil && [sec_id isProxy]) {
2522 if (secondary !=
nil && secondary != primary) {
2532- (void)drawWaypoints:(NSDictionary*)info
2534 GLfloat alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2535 GLfloat scale = [
info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
2538 Entity* compass = [PLAYER compassTarget];
2540 foreach (waypoint, [[
UNIVERSE currentWaypoints] allValues]) {
2545- (void)drawStatusLight:(NSDictionary*)info
2549 GLfloat alpha = overallAlpha;
2550 BOOL blueAlert = cloakIndicatorOnStatusLight && [PLAYER isCloaked];
2553 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2559 alpha *= cached.
alpha;
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));
2565 switch (alertCondition) {
2588 status_color[3] = flash_alpha;
2589 GLColorWithOverallAlpha(status_color, alpha);
2593 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
2599- (void)drawDirectionCue:(NSDictionary*)info
2601 GLfloat alpha = overallAlpha;
2604 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2606 alpha *= cached.
alpha;
2611 Entity* target = [PLAYER primaryTarget];
2618 rotMatrix = [PLAYER rotationMatrix];
2620 if ([
UNIVERSE viewDirection] != VIEW_GUI_DISPLAY) {
2624 const float visMin = 0.994521895368273f;
2625 const float visMax = 0.984807753012208f;
2628 Vector rpn = [PLAYER vectorTo:target];
2633 switch ([
UNIVERSE viewDirection]) {
2638 drawPos.
x = -drawPos.
x;
2642 drawPos.
x = drawPos.
z;
2645 case VIEW_STARBOARD:
2646 drawPos.
x = -drawPos.
z;
2657 float visibility = 1.0f - ((visMax - cosAngle) * (1.0f / (visMax - visMin)));
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);
2685- (void)drawClock:(NSDictionary*)info
2689 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2692 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2700 itemColor[3] *= overallAlpha;
2702 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2706- (void)drawPrimedEquipment:(NSDictionary*)info
2708 if ([
PLAYER status] == STATUS_DOCKED) {
2713 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2716 NSUInteger lines = [
info oo_intForKey:@"n_bars" defaultValue:1];
2717 NSInteger pec = (NSInteger)[
PLAYER primedEquipmentCount];
2719 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2738 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2739 NSString* equipmentName = [PLAYER primedEquipmentName:0];
2742 NSInteger negative = (lines - 1) / 2;
2743 NSInteger positive = lines / 2;
2744 for (NSInteger i = -negative; i <= positive; i++) {
2745 if (i >= -(pec) / 2 && i <= (pec + 1) / 2) {
2748 GLfloat alphaScale = 1.0 / ((i < 0) ? (1.0 - i) : (1.0 + i));
2749 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3] * alphaScale));
2757- (void)drawASCTarget:(NSDictionary*)info
2765 GLfloat itemColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
2768 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2779 itemColor[3] *= overallAlpha;
2781 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2782 if ([info oo_intForKey:
@"align"] == 1) {
2789- (void)drawWeaponsOfflineText:(NSDictionary*)info
2791 OOViewID viewID = [UNIVERSE viewDirection];
2792 GLfloat textColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2794 if (viewID == VIEW_CUSTOM || overallAlpha == 0.0f || !([
PLAYER status] == STATUS_IN_FLIGHT || [
PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
2800 if (![
PLAYER weaponsOnline]) {
2805 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2813 textColor[3] *= overallAlpha;
2815 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], textColor[3]));
2821- (void)drawFPSInfoCounter:(NSDictionary*)info
2829 GLfloat textColor[4] = { 0.0, 1.0, 0.0, 1.0 };
2831 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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];
2845 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], 1.0f));
2849 NSSize siz08 = NSMakeSize(0.8 * siz.width, 0.8 * siz.width);
2850 NSString* collDebugInfo = [
NSString stringWithFormat:@"%@ - %@", [PLAYER dial_objinfo], [UNIVERSE collisionDescription]];
2855 NSString* timeAccelerationFactorInfo = [
NSString stringWithFormat:@"TAF: %@%.2f", DESC(@"multiplication-sign"), [UNIVERSE timeAccelerationFactor]];
2856 OODrawString(timeAccelerationFactorInfo,
x,
y - 3.2 * siz08.height, z1, siz08);
2860- (void)drawScoopStatus:(NSDictionary*)info
2867 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2874 alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:0.75f];
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));
2886 switch (scoop_status) {
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];
2912 s1c[3] = alpha * a1;
2913 s2c[3] = alpha * a2;
2914 s3c[3] = alpha * a3;
2921 GLfloat w1 = siz.width / 8.0;
2922 GLfloat w2 = 2.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;
2930 OOGL(glDisable(GL_TEXTURE_2D));
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);
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);
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);
2961- (void)drawStickSensitivityIndicator:(NSDictionary*)info
2965 GLfloat alpha = overallAlpha;
2966 BOOL mouse = [PLAYER isMouseControlOn];
2970 if (![stickHandler joystickCount]) {
2974 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2980 alpha *= cached.
alpha;
2992 NSSize siz8th = { siz.width / 8, siz.height / 8 };
2999 siz.width -= _crosshairWidth * lineWidth / 2;
3000 siz.height -= _crosshairWidth * lineWidth / 2;
3002 }
else if (div < 1.0)
3008- (void)drawSurroundInternal:(NSDictionary*)info color:(const GLfloat[4])color
3012 GLfloat alpha = overallAlpha;
3015 [(
NSValue*)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3021 x = cached.
x + [[UNIVERSE gameView] x_offset] * cached.
x0;
3022 y = cached.
y + [[UNIVERSE gameView] y_offset] * cached.
y0;
3025 alpha *= cached.
alpha;
3028 GLColorWithOverallAlpha(color, alpha);
3032- (void)drawSurround:(NSDictionary*)info
3034 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
3035 id colorDesc = [
info objectForKey:COLOR_KEY];
3036 if (colorDesc !=
nil) {
3048- (void)drawGreenSurround:(NSDictionary*)info
3053- (void)drawYellowSurround:(NSDictionary*)info
3058- (void)drawTrumbles:(NSDictionary*)info
3060 OOTrumble** trumbles = [PLAYER trumbleArray];
3062 for (i = [
PLAYER trumbleCount]; i > 0; i--) {
3068- (void)drawMultiFunctionDisplay:(NSDictionary*)info withText:(NSString*)text asIndex:(NSUInteger)index
3074 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3078 GLfloat alpha = [
info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
3080 GLfloat mfd_color[4] = { 0.0, 1.0, 0.0, 0.9 * alpha };
3082 if (mfdcol !=
nil) {
3085 if (index != [player1 activeMFD]) {
3086 mfd_color[3] *= 0.75;
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;
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);
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);
3109 NSString* line =
nil;
3110 NSArray* lines = [
text componentsSeparatedByString:@"\n"];
3112 GLColorWithOverallAlpha(mfd_color, alpha);
3113 for (i = 0; i < 10; i++) {
3114 line = [
lines oo_stringAtIndex:i defaultValue:nil];
3119 if (textwidth <= cached.
width) {
3123 tmpsiz.height = siz.height;
3124 tmpsiz.width = siz.width * cached.
width / textwidth;
3137 if (siz.width > siz.height) {
3138 GLfloat dial_oy =
y - siz.height / 2;
3139 GLfloat position =
x + amount * siz.width / 2;
3141 glVertex3f(position, dial_oy, z);
3142 glVertex3f(position + 2,
y, z);
3143 glVertex3f(position, dial_oy + siz.height, z);
3144 glVertex3f(position - 2,
y, z);
3147 GLfloat dial_ox =
x - siz.width / 2;
3148 GLfloat position =
y + amount * siz.height / 2;
3150 glVertex3f(dial_ox, position, z);
3151 glVertex3f(
x, position + 2, z);
3152 glVertex3f(dial_ox + siz.width, position, z);
3153 glVertex3f(
x, position - 2, z);
3160 if (siz.width > siz.height) {
3161 GLfloat dial_oy =
y - siz.height / 2;
3162 GLfloat position =
x + amount * siz.width - siz.width / 2;
3164 glVertex3f(position + 1, dial_oy + 1, z);
3165 glVertex3f(position + 1, dial_oy + siz.height - 1, z);
3166 glVertex3f(position - 1, dial_oy + siz.height - 1, z);
3167 glVertex3f(position - 1, dial_oy + 1, z);
3170 GLfloat dial_ox =
x - siz.width / 2;
3171 GLfloat position =
y + amount * siz.height - siz.height / 2;
3173 glVertex3f(dial_ox + 1, position + 1, z);
3174 glVertex3f(dial_ox + siz.width - 1, position + 1, z);
3175 glVertex3f(dial_ox + siz.width - 1, position - 1, z);
3176 glVertex3f(dial_ox + 1, position - 1, z);
3183 GLfloat dial_ox =
x - siz.width / 2;
3184 GLfloat dial_oy =
y - siz.height / 2;
3185 if (fabs(siz.width) > fabs(siz.height)) {
3186 GLfloat position = dial_ox + amount * siz.width;
3189 glVertex3f(dial_ox, dial_oy, z);
3190 glVertex3f(position, dial_oy, z);
3191 glVertex3f(position, dial_oy + siz.height, z);
3192 glVertex3f(dial_ox, dial_oy + siz.height, z);
3195 GLfloat position = dial_oy + amount * siz.height;
3198 glVertex3f(dial_ox, dial_oy, z);
3199 glVertex3f(dial_ox, position, z);
3200 glVertex3f(dial_ox + siz.width, position, z);
3201 glVertex3f(dial_ox + siz.width, dial_oy, z);
3208 GLfloat dial_ox =
x - siz.width / 2;
3209 GLfloat dial_oy =
y - siz.height / 2;
3212 glVertex3f(dial_ox - 2, dial_oy - 2, z);
3213 glVertex3f(dial_ox + siz.width + 2, dial_oy - 2, z);
3214 glVertex3f(dial_ox + siz.width + 2, dial_oy + siz.height + 2, z);
3215 glVertex3f(dial_ox - 2, dial_oy + siz.height + 2, z);
3221 int ox =
x - siz.width / 2.0;
3222 int oy =
y - siz.height / 2.0;
3223 int w = siz.width / 4.0;
3224 int h = siz.height / 4.0;
3226 glVertex3i(ox, oy + h, z);
3227 glVertex3i(ox, oy + 3 * h, z);
3228 glVertex3i(ox + w, oy + 4 * h, z);
3229 glVertex3i(ox + 3 * w, oy + 4 * h, z);
3230 glVertex3i(ox + 4 * w, oy + 3 * h, z);
3231 glVertex3i(ox + 4 * w, oy + h, z);
3232 glVertex3i(ox + 3 * w, oy, z);
3233 glVertex3i(ox + w, oy, z);
3238 BOOL colourFromScannerColour, BOOL showText, NSDictionary* info, NSMutableArray* reticleColors)
3240 if (target ==
nil || player1 ==
nil) {
3243 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3249 NSString* legal_desc =
nil;
3251 GLfloat scale = [
info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
3253 if ([target isShip]) {
3258 if ([target_ship isCloaked])
3269 if (rsize < rdist * scale)
3270 rsize = rdist * scale;
3272 GLfloat rs0 = rsize;
3273 GLfloat rs2 = rsize * 0.50;
3285 if ([target isWormhole]) {
3294 BOOL isTargeted = NO;
3295 GLfloat probabilityAccuracy;
3299 if (range < [player1 weaponRange]) {
3307 [propertiesReticleTargetSensitive setObject:[
NSNumber numberWithBool:((randf() < probabilityAccuracy) ? YES : NO)] forKey:@"isAccurate"];
3310 [propertiesReticleTargetSensitive setObject:[
NSNumber numberWithDouble:[UNIVERSE getTime]] forKey:@"timeLastAccuracyProbabilityCalculation"];
3314 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3317 isTargeted = ([UNIVERSE firstEntityTargetedByPlayer] == target);
3321 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3334 if (colourFromScannerColour) {
3335 if ([target isShip]) {
3338 GLColorWithOverallAlpha([ship scannerDisplayColorForShip:
PLAYER isHostile:isHostile flash:flash scannerDisplayColor1:[ship scannerDisplayColor1] scannerDisplayColor2:[ship scannerDisplayColor2] scannerDisplayColorH1:[ship scannerDisplayColorHostile1] scannerDisplayColorH2:[ship scannerDisplayColorHostile2]], alpha);
3339 }
else if ([target isVisualEffect]) {
3341 GLColorWithOverallAlpha([vis scannerDisplayColorForShip:flash scannerDisplayColor1:[vis scannerDisplayColor1] scannerDisplayColor2:[vis scannerDisplayColor2]], alpha);
3348 reticleDisplayColor = [
reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET_SENSITIVE];
3349 if (!reticleDisplayColor)
3352 reticleDisplayColor = [
reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET];
3353 if (!reticleDisplayColor)
3364 glVertex2f(rs0, rs2);
3365 glVertex2f(rs0, rs0);
3366 glVertex2f(rs0, rs0);
3367 glVertex2f(rs2, rs0);
3369 glVertex2f(rs0, -rs2);
3370 glVertex2f(rs0, -rs0);
3371 glVertex2f(rs0, -rs0);
3372 glVertex2f(rs2, -rs0);
3374 glVertex2f(-rs0, rs2);
3375 glVertex2f(-rs0, rs0);
3376 glVertex2f(-rs0, rs0);
3377 glVertex2f(-rs2, rs0);
3379 glVertex2f(-rs0, -rs2);
3380 glVertex2f(-rs0, -rs0);
3381 glVertex2f(-rs0, -rs0);
3382 glVertex2f(-rs2, -rs0);
3390 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3391 float line_height = rdist * scale;
3392 NSString* infoline = [
NSString stringWithFormat:@"%0.3f %@", range, distance_unit];
3393 if (legal_desc !=
nil)
3394 infoline = [
NSString stringWithFormat:@"%@ (%@)", infoline, legal_desc];
3396 OODrawString([player1 dialTargetName], rs0, 0.5 * rs2, 0, textsize);
3397 OODrawString(infoline, rs0, 0.5 * rs2 - line_height, 0, textsize);
3399 if ([target isWormhole]) {
3410 OODrawString(wormholeETA, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
3414 int minutesToCollapse = floor(timeForCollapsing / 60.0);
3415 int secondsToCollapse = (
int)timeForCollapsing % 60;
3417 NSString* wormholeExpiringIn = [
NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
3418 OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
3432 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3446 GLfloat rsize = rdist * scale;
3448 GLfloat rs0 = rsize;
3449 GLfloat rs2 = rsize * 0.50;
3458 glVertex2f(rs0, rs2);
3459 glVertex2f(rs2, rs2);
3460 glVertex2f(rs2, rs0);
3461 glVertex2f(rs2, rs2);
3463 glVertex2f(-rs0, rs2);
3464 glVertex2f(-rs2, rs2);
3465 glVertex2f(-rs2, rs0);
3466 glVertex2f(-rs2, rs2);
3468 glVertex2f(-rs0, -rs2);
3469 glVertex2f(-rs2, -rs2);
3470 glVertex2f(-rs2, -rs0);
3471 glVertex2f(-rs2, -rs2);
3473 glVertex2f(rs0, -rs2);
3474 glVertex2f(rs2, -rs2);
3475 glVertex2f(rs2, -rs0);
3476 glVertex2f(rs2, -rs2);
3483 GLfloat range =
HPdistance([player1 position], [waypoint position]) * 0.001f;
3486 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3487 float line_height = rdist * scale;
3488 NSString* infoline = [
NSString stringWithFormat:@"%0.3f %@", range, distance_unit];
3489 OODrawString(infoline, rs0 * 0.5, -rs2 - line_height, 0, textsize);
3498 back_q.
w = -back_q.
w;
3500 NSSize viewSize = [[UNIVERSE gameView] viewSize];
3501 float aspect = viewSize.width / viewSize.height;
3506 float ratio = 2 * [[UNIVERSE gameView] fov:YES];
3507 if (3.0f * aspect >= 4.0f) {
3515 switch ([
UNIVERSE viewDirection]) {
3537 case VIEW_STARBOARD:
3564static void InitTextEngine(
void)
3566 NSDictionary* fontSpec =
nil;
3567 NSArray* widths =
nil;
3568 NSString* texName =
nil;
3569 NSUInteger i,
count;
3575 texName = [
fontSpec oo_stringForKey:@"texture" defaultValue:@"oolite-font.png"];
3587 widths = [
fontSpec oo_arrayForKey:@"widths"];
3591 for (i = 0; i !=
count; ++i) {
3606 if (chr > 32 || chr < 31) {
3613 glVertex3f(
x,
y, z);
3615 glVertex3f(
x + siz.width,
y, z);
3617 glVertex3f(
x + siz.width,
y + siz.height, z);
3618 glTexCoord2f(texture_x, texture_y);
3619 glVertex3f(
x,
y + siz.height, z);
3628 const uint8_t* bytes = NULL;
3629 NSUInteger i, length;
3632 bytes = [
data bytes];
3633 length = [
data length];
3635 for (i = 0; i < length; i++) {
3639 return NSMakeRect(
x,
y, w, siz.height);
3650 OOGL(glColor4f(0.0f, 0.0f, 0.0f, alpha * 0.4f));
3654 glVertex3f(
x + 1.0f,
y + siz.height + 2.5f, z);
3655 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.5f, z);
3656 glVertex3f(
x + siz.width + 4.5f,
y + siz.height + 1.0f, z);
3657 glVertex3f(
x + siz.width + 4.5f,
y + 3.0f, z);
3658 glVertex3f(
x + siz.width + 3.0f,
y + 1.5f, z);
3659 glVertex3f(
x + 1.0f,
y + 1.5f, z);
3660 glVertex3f(
x - 0.5f,
y + 3.0f, z);
3661 glVertex3f(
x - 0.5f,
y + siz.height + 1.0f, z);
3665 glVertex3f(
x + 1.0f,
y + siz.height + 2.0f, z);
3666 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.0f, z);
3667 glVertex3f(
x + siz.width + 4.0f,
y + siz.height + 1.0f, z);
3668 glVertex3f(
x + siz.width + 4.0f,
y + 3.0f, z);
3669 glVertex3f(
x + siz.width + 3.0f,
y + 2.0f, z);
3670 glVertex3f(
x + 1.0f,
y + 2.0f, z);
3671 glVertex3f(
x,
y + 3.0f, z);
3672 glVertex3f(
x,
y + siz.height + 1.0f, z);
3692 OOGL(glEnable(GL_TEXTURE_2D));
3700 NSInteger i, length;
3702 const uint8_t* bytes = NULL;
3705 length = [
data length];
3706 bytes = [
data bytes];
3712 for (i = 0; i < length; i++) {
3722 OOGL(glDisable(GL_TEXTURE_2D));
3733 strsize.width += 0.5f;
3737 OOGL(glPushAttrib(GL_CURRENT_BIT));
3738 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
3742 OOGL(glPopAttrib());
3751 GLfloat govcol[] = { 0.5, 0.0, 0.7,
3762 GLfloat ce1 = 1.0f - 0.125f * eco;
3766 OOGL(glEnable(GL_TEXTURE_2D));
3771 [[UNIVERSE gui] setGLColorFromSetting:[
NSString stringWithFormat:kGuiChartEconomyUColor, (size_t)eco]
3777 [[UNIVERSE gui] setGLColorFromSetting:[
NSString stringWithFormat:kGuiChartGovernmentUColor, (size_t)gov]
3782 [[UNIVERSE gui] setGLColorFromSetting:kGuiChartTechColor
3797 OOGL(glDisable(GL_TEXTURE_2D));
3810 hisize.height = siz.height;
3811 hisize.width = 0.0f;
3822 OOGL(glPushAttrib(GL_CURRENT_BIT));
3823 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
3827 OOGL(glPopAttrib());
3836 Vector spacepos, scannerpos;
3838 GLfloat z_factor = siz.height / siz.width;
3839 GLfloat y_factor = 1.0 - sqrt(z_factor);
3843 if (radius * radius > centre.
y * centre.
y) {
3844 GLfloat r0 = sqrt(radius * radius - centre.
y * centre.
y);
3845 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
3847 for (i = 0; i < 24; i++) {
3848 theta = i * 2 *
M_PI / 24;
3849 spacepos.
x = centre.
x + r0 * cos(theta);
3850 spacepos.
z = centre.
z + r0 * sin(theta);
3852 points[
i].
x =
x + scannerpos.
x;
3853 points[
i].
y =
y + scannerpos.
z * z_factor + scannerpos.
y * y_factor;
3856 spacepos.
x = centre.
x + r0;
3858 spacepos.
z = centre.
z;
3860 points[24].
x =
x + scannerpos.
x;
3861 points[24].
y =
y + scannerpos.
z * z_factor + scannerpos.
y * y_factor;
3865 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
3871 spacepos.
x = centre.
x;
3872 spacepos.
y = centre.
y + radius;
3873 spacepos.
z = centre.
z;
3875 for (i = 0; i <= 24; i++) {
3876 points[2 *
i + 1].
x =
x + scannerpos.
x;
3877 points[2 *
i + 1].
y =
y + scannerpos.
y * y_factor + scannerpos.
z * z_factor;
3878 points[2 *
i + 1].
z = z;
3880 for (i = 1; i <= 24; i++) {
3881 theta = i *
M_PI / 24;
3882 for (j = 0; j <= 24; j++) {
3883 phi = j *
M_PI / 12;
3885 points[2 *
j] = points[2 *
j + 1];
3887 spacepos.
x = centre.
x + radius * sin(theta) * cos(phi);
3888 spacepos.
y = centre.
y + radius * cos(theta);
3889 spacepos.
z = centre.
z + radius * sin(theta) * sin(phi);
3891 points[2 *
j + 1].
x =
x + scannerpos.
x;
3892 points[2 *
j + 1].
y =
y + scannerpos.
y * y_factor + scannerpos.
z * z_factor;
3893 points[2 *
j + 1].
z = z;
3908 GLfloat c = 1 / (zoom - 1);
3909 GLfloat b = c * (c + 1);
3911 return scale * (a - b / (
x + c));
3914static void drawScannerGrid(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz,
int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
3921 GLfloat ww = 0.5 * siz.width;
3922 GLfloat hh = 0.5 * siz.height;
3927 BOOL drawdiv = NO, drawdiv1 = NO, drawdiv5 = NO;
3936 if (!minimalistic) {
3937 glVertex3f(
x,
y - hh, z);
3938 glVertex3f(
x,
y + hh, z);
3939 glVertex3f(
x - ww,
y, z);
3940 glVertex3f(
x + ww,
y, z);
3959 }
else if (i % 5 == 0) {
3970 glVertex3f(
x - w1,
y + h1, z);
3971 glVertex3f(
x + w1,
y + h1, z);
3972 glVertex3f(
x - w1,
y - h1, z);
3973 glVertex3f(
x + w1,
y - h1, z);
3978 hdiv = 0.5 * siz.height / km_scan;
3979 wdiv = 0.25 * siz.width / km_scan;
3987 for (i = ii; 2.0 * hdiv * i < siz.height; i += ii) {
3996 glVertex3f(
x - w1,
y + h1, z);
3997 glVertex3f(
x + w1,
y + h1, z);
3998 glVertex3f(
x - w1,
y - h1, z);
3999 glVertex3f(
x + w1,
y - h1, z);
4007 if (aspect < 4.0 / 3.0) {
4008 tanfov *= 0.75 * aspect;
4010 double cosfov = 1.0 / sqrt(1 + tanfov * tanfov);
4011 double sinfov = tanfov * cosfov;
4014 case VIEW_BREAK_PATTERN:
4015 case VIEW_GUI_DISPLAY:
4018 glVertex3f(
x,
y, z);
4019 glVertex3f(
x - ww * sinfov,
y + hh * cosfov, z);
4020 glVertex3f(
x,
y, z);
4021 glVertex3f(
x + ww * sinfov,
y + hh * cosfov, z);
4025 glVertex3f(
x,
y, z);
4026 glVertex3f(
x - ww * sinfov,
y - hh * cosfov, z);
4027 glVertex3f(
x,
y, z);
4028 glVertex3f(
x + ww * sinfov,
y - hh * cosfov, z);
4032 glVertex3f(
x,
y, z);
4033 glVertex3f(
x - ww * cosfov,
y + hh * sinfov, z);
4034 glVertex3f(
x,
y, z);
4035 glVertex3f(
x - ww * cosfov,
y - hh * sinfov, z);
4038 case VIEW_STARBOARD:
4039 glVertex3f(
x,
y, z);
4040 glVertex3f(
x + ww * cosfov,
y + hh * sinfov, z);
4041 glVertex3f(
x,
y, z);
4042 glVertex3f(
x + ww * cosfov,
y - hh * sinfov, z);
4050static void DrawSpecialOval(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat step, GLfloat* color4v)
4052 GLfloat ww = 0.5 * siz.width;
4053 GLfloat hh = 0.5 * siz.height;
4058 delta = step *
M_PI / 180.0f;
4061 for (theta = 0.0f; theta < (2.0f *
M_PI); theta += delta) {
4063 glColor4f(color4v[0], color4v[1], color4v[2], fabs(s * color4v[3]));
4064 glVertex3f(
x + ww * s,
y + hh * cos(theta), z);
4069- (void)setLineWidth:(GLfloat)value
4081@implementation NSString (OODisplayEncoding)
4103@implementation OOPolygonSprite (OOHUDBeaconIcon)
4105- (void)oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4107 GLfloat
x = where.x -
size.width;
4108 GLfloat
y = where.y - 1.5 *
size.height;
4110 GLfloat ox =
x -
size.width * 0.5;
4111 GLfloat oy =
y -
size.height * 0.5;
4112 GLfloat width =
size.width * (1.0f / 6.0f);
4113 GLfloat height =
size.height * (1.0f / 6.0f);
4119 glColor4f(0.0, 0.0, 0.0, 0.5 * alpha);
4126@implementation NSString (OOHUDBeaconIcon)
4128- (void)oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4135static void SetGLColourFromInfo(NSDictionary* info, NSString* key,
const GLfloat defaultColor[4], GLfloat alpha)
4139 colorDesc = [info objectForKey:key];
4140 if (colorDesc !=
nil) {
4145 GLColorWithOverallAlpha(ioColor, alpha);
4149 GLColorWithOverallAlpha(defaultColor, alpha);
4158 colorDesc = [info objectForKey:RGB_COLOR_KEY];
4159 if (colorDesc !=
nil && ![info objectForKey:
ALPHA_KEY]) {
4168 colorDesc = [info oo_arrayForKey:RGB_COLOR_KEY];
4169 if (colorDesc !=
nil && [colorDesc
count] == 3) {
4170 ioColor[0] = [colorDesc oo_nonNegativeFloatAtIndex:0];
4171 ioColor[1] = [colorDesc oo_nonNegativeFloatAtIndex:1];
4172 ioColor[2] = [colorDesc oo_nonNegativeFloatAtIndex:2];
4174 ioColor[3] = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:ioColor[3]];
#define SCANNER_MAX_RANGE
#define SCANNER_MAX_RANGE2
#define ZOOM_INDICATOR_HEIGHT
#define CABIN_TEMP_BAR_HEIGHT
#define AFT_SHIELD_BAR_HEIGHT
#define FPSINFO_DISPLAY_Y
#define SCOOPSTATUS_HEIGHT
#define CABIN_TEMP_BAR_CENTRE_Y
#define FPSINFO_DISPLAY_WIDTH
#define MISSILE_ICON_WIDTH
#define ASCTARGET_DISPLAY_WIDTH
#define STATUS_LIGHT_CENTRE_X
#define ALTITUDE_BAR_CENTRE_X
#define SPEED_BAR_CENTRE_Y
void OODrawStringAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
#define ZOOM_INDICATOR_WIDTH
#define PITCH_BAR_CENTRE_Y
#define SCOOPSTATUS_CENTRE_X
#define ASCTARGET_DISPLAY_HEIGHT
#define ROLL_BAR_CENTRE_Y
#define WEAPON_TEMP_BAR_HEIGHT
#define SCOOPSTATUS_WIDTH
#define ALTITUDE_BAR_WIDTH
#define SCANNER_ZOOM_LEVELS
#define CABIN_TEMP_BAR_WIDTH
#define CLOCK_DISPLAY_WIDTH
#define WEAPONSOFFLINETEXT_WIDTH
#define FORWARD_SHIELD_BAR_HEIGHT
#define WEAPON_TEMP_BAR_WIDTH
void OOHUDResetTextEngine(void)
#define FORWARD_SHIELD_BAR_WIDTH
void OODrawStringQuadsAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
#define AFT_SHIELD_BAR_CENTRE_Y
#define FORWARD_SHIELD_BAR_CENTRE_Y
#define PRIMED_DISPLAY_WIDTH
#define WEAPONSOFFLINETEXT_DISPLAY_X
#define WEAPONSOFFLINETEXT_HEIGHT
void OOStartDrawingStrings(void)
#define FPSINFO_DISPLAY_HEIGHT
#define CABIN_TEMP_BAR_CENTRE_X
#define MISSILES_DISPLAY_Y
#define FUEL_BAR_CENTRE_Y
#define FUEL_BAR_CENTRE_X
#define WEAPON_TEMP_BAR_CENTRE_X
NSRect OORectFromString(NSString *text, GLfloat x, GLfloat y, NSSize siz)
#define ZOOM_INDICATOR_CENTRE_X
#define AFT_SHIELD_BAR_WIDTH
#define PITCH_BAR_CENTRE_X
#define ALTITUDE_BAR_HEIGHT
#define ACCURACY_PROBABILITY_DECREASE_FACTOR
@ OO_RETICLE_COLOR_TARGET
@ OO_RETICLE_COLOR_WORMHOLE
#define ASCTARGET_DISPLAY_X
#define ENERGY_GAUGE_CENTRE_X
#define MISSILES_DISPLAY_X
#define MIN_PROBABILITY_ACCURACY
#define WEAPONSOFFLINETEXT_DISPLAY_Y
#define FORWARD_SHIELD_BAR_CENTRE_X
#define ROLL_BAR_CENTRE_X
#define DIAL_REQUIRED_KEY
void OODrawString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
#define WEAPON_TEMP_BAR_CENTRE_Y
#define AFT_SHIELD_BAR_CENTRE_X
void OODrawPlanetInfo(int gov, int eco, int tec, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
#define CLOCK_DISPLAY_HEIGHT
#define PRIMED_DISPLAY_HEIGHT
#define FPSINFO_DISPLAY_X
#define ENERGY_GAUGE_HEIGHT
#define BACKGROUND_RGBA_KEY
#define WITCHDEST_CENTRE_X
#define ENERGY_GAUGE_WIDTH
void OOStopDrawingStrings(void)
#define MAX_ACCURACY_RANGE
#define ALTITUDE_BAR_CENTRE_Y
#define COMPASS_HALF_SIZE
#define WITCHDEST_CENTRE_Y
#define ASCTARGET_DISPLAY_Y
#define MISSILE_ICON_HEIGHT
#define STATUS_LIGHT_CENTRE_Y
#define STATUS_LIGHT_HEIGHT
#define SCOOPSTATUS_CENTRE_Y
#define ENERGY_GAUGE_CENTRE_Y
#define ZOOM_INDICATOR_CENTRE_Y
#define SPEED_BAR_CENTRE_X
static void hudRotateViewpointForVirtualDepth(PlayerEntity *player1, Vector p1)
static void hudDrawStatusIconAt(int x, int y, int z, NSSize siz)
#define SET_COLOR_CRITICAL(d)
static void hudDrawWaypoint(OOWaypointEntity *waypoint, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL selected, GLfloat scale)
static NSString * distance_unit
static const GLfloat redplus_color[4]
#define SET_COLOR_MEDIUM(d)
static NSString *const kDefaultMissileIconKey
static NSString *const kDefaultMineIconKey
static float sGlyphWidths[256]
static OOEncodingConverter * sEncodingCoverter
#define WIDGET_SELECTOR_NAME
static OOTexture * sFontTexture
static void SetGLColourFromInfo(NSDictionary *info, NSString *key, const GLfloat defaultColor[4], GLfloat alpha)
static void DrawSpecialOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step, GLfloat *color4v)
static const GLfloat green_color[4]
static GLfloat nonlinearScannerFunc(GLfloat distance, GLfloat zoom, GLfloat scale)
static const GLfloat darkgreen_color[4]
static void hudDrawSurroundAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz)
static void GLDrawNonlinearCascadeWeapon(GLfloat x, GLfloat y, GLfloat z, NSSize siz, Vector centre, GLfloat radius, GLfloat zoom, GLfloat alpha)
static void hudDrawReticleOnTarget(Entity *target, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive, BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
static NSArray * sCurrentDrawItem
static const GLfloat lightgray_color[4]
static BOOL _compassUpdated
static const GLfloat black_color[4]
#define SET_COLOR_HIGH(d)
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
static const GLfloat blue_color[4]
static const GLfloat yellow_color[4]
#define SET_COLOR_SURROUND(d)
static void hudDrawMarkerAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
#define GLYPH_SCALE_FACTOR
static const GLfloat red_color[4]
static void GetRGBAArrayFromInfo(NSDictionary *info, GLfloat ioColor[4])
static void drawScannerGrid(GLfloat x, GLfloat y, GLfloat z, NSSize siz, int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
OOINLINE float useDefined(float val, float validVal)
static void hudDrawBarAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
static const GLfloat kOutlineWidth
OOINLINE float OOClamp_n1_1_f(float value) INLINE_CONST_FUNC
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
OOINLINE HPVector HPvector_subtract(HPVector a, HPVector b) INLINE_CONST_FUNC
OOINLINE Vector HPVectorToVector(HPVector v) INLINE_CONST_FUNC
OOINLINE OOHPScalar HPdistance(HPVector v1, HPVector v2) INLINE_CONST_FUNC
#define OOLogERR(class, format,...)
NSString *const kOOLogFileNotFound
Vector OOVectorMultiplyMatrix(Vector v, OOMatrix m) CONST_FUNC
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
void OOGLLookAt(Vector eye, Vector center, Vector up)
void OOGLScaleModelView(Vector scale)
void OOGLPushModelView(void)
void OOGLTranslateModelView(Vector vector)
void OOGLMultModelView(OOMatrix matrix)
OOMatrix OOGLPopModelView(void)
void GLDrawFilledOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
void GLDrawPoints(OOGLVector *points, int n)
void GLDrawQuadStrip(OOGLVector *points, int n)
#define OOVerifyOpenGLState()
BOOL OOCheckOpenGLErrors(NSString *format,...)
void GLScaledLineWidth(GLfloat width)
void GLDrawOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step)
#define OOSetOpenGLState(STATE)
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle) NONNULL_FUNC
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2) CONST_FUNC
Vector vector_up_from_quaternion(Quaternion quat) CONST_FUNC
#define OOExpandKey(key,...)
@ OO_SYSTEMCONCEALMENT_NONAME
@ kOOTextureMinFilterMipMap
@ kOOTextureMagFilterLinear
OOINLINE Vector vector_flip(Vector v) INLINE_CONST_FUNC
OOINLINE Vector vector_add(Vector a, Vector b) INLINE_CONST_FUNC
OOINLINE OOScalar magnitude(Vector vec) INLINE_CONST_FUNC
OOINLINE Vector make_vector(OOScalar vx, OOScalar vy, OOScalar vz) INLINE_CONST_FUNC
OOINLINE OOScalar dot_product(Vector first, Vector second) INLINE_CONST_FUNC
OOINLINE Vector vector_normal_or_fallback(Vector vec, Vector fallback) INLINE_CONST_FUNC
const Vector kBasisYVector
OOINLINE void scale_vector(Vector *outVector, OOScalar factor) ALWAYS_INLINE_FUNC NONNULL_FUNC
const Vector kBasisZVector
const Vector kBasisXVector
Vector OOVectorRandomRadial(OOScalar maxLength)
OOINLINE OOScalar distance(Vector v1, Vector v2) INLINE_CONST_FUNC
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
OOINLINE Vector vector_normal(Vector vec) INLINE_CONST_FUNC
@ SCOOP_STATUS_NOT_INSTALLED
@ MISSILE_STATUS_TARGET_LOCKED
#define PLAYER_TARGET_MEMORY_SIZE
OOEquipmentType * OOWeaponType
NSString * OOStringFromWeaponType(OOWeaponType weapon) CONST_FUNC
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
BOOL checkPlayerInFlight()
BOOL checkPlayerInSystemFlight()
const char * cStringUsingOoliteEncoding()
const char * cStringUsingOoliteEncodingAndRemapping()
OOUniversalID universalID
GLfloat collisionRadius()
void setTextColor:(OOColor *color)
void resizeTo:characterHeight:title:(NSSize gui_size,[characterHeight] int csize,[title] NSString *gui_title)
void setMaxAlpha:(GLfloat an_alpha)
void setDrawPosition:(Vector vector)
void setCharacterSize:(NSSize character_size)
void setBackgroundColor:(OOColor *color)
void printLongText:align:color:fadeTime:key:addToArray:(NSString *str,[align] OOGUIAlignment alignment,[color] OOColor *text_color,[fadeTime] float text_fade,[key] NSString *text_key,[addToArray] NSMutableArray *text_array)
void setTextCommsColor:(OOColor *color)
void setAlpha:(GLfloat an_alpha)
void setCurrentRow:(OOGUIRow value)
void drawSecondaryTargetReticle:(NSDictionary *info)
NSArray * crosshairDefinitionForWeaponType:(OOWeaponType weapon)
OOCrosshairs * _crosshairs
static void DrawSpecialOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step, GLfloat *color4v)
void drawCompassBeaconBlipAt:Size:Alpha:(Vector relativePosition, [Size] NSSize siz, [Alpha] GLfloat alpha)
NSMutableArray * _reticleColors
Vector nonlinearScannerScale:Zoom:Scale:(Vector V,[Zoom] GLfloat zoom,[Scale] double scale)
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
static void hudDrawStatusIconAt(int x, int y, int z, NSSize siz)
void OOStopDrawingStrings()
void OODrawHilightedPlanetInfo(int gov, int eco, int tec, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
static void hudRotateViewpointForVirtualDepth(PlayerEntity *player1, Vector p1)
BOOL setCrosshairDefinition:(NSString *newDefinition)
void resetGuiPosition:withInfo:(GuiDisplayGen *gui, [withInfo] NSDictionary *gui_info)
void addDial:(NSDictionary *info)
void OODrawStringQuadsAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
NSString * deferredHudName
void addMFD:(NSDictionary *info)
NSString * crosshairDefinition
static GLfloat nonlinearScannerFunc(GLfloat distance, GLfloat zoom, GLfloat scale)
id initWithDictionary:inFile:(NSDictionary *hudinfo,[inFile] NSString *hudFileName)
void drawIconForMissile:selected:status:x:y:width:height:alpha:(ShipEntity *missile, [selected] BOOL selected, [status] OOMissileStatus status, [x] int x, [y] int y, [width] GLfloat width, [height] GLfloat height, [alpha] GLfloat alpha)
OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
void drawCompassPlanetBlipAt:Size:Alpha:(Vector relativePosition, [Size] NSSize siz, [Alpha] GLfloat alpha)
static void hudDrawBarAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
void addLegend:(NSDictionary *info)
OOColor * _crosshairColor
static OOPolygonSprite * IconForMissileRole(NSString *role)
OOWeaponType _lastWeaponType
void drawCompassTargetBlipAt:Size:Alpha:(Vector relativePosition, [Size] NSSize siz, [Alpha] GLfloat alpha)
static void hudDrawSurroundAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz)
void drawMultiFunctionDisplay:withText:asIndex:(NSDictionary *info, [withText] NSString *text, [asIndex] NSUInteger index)
NSMutableSet * _hiddenSelectors
void drawCompassStationBlipAt:Size:Alpha:(Vector relativePosition, [Size] NSSize siz, [Alpha] GLfloat alpha)
NSRect OORectFromString(NSString *text, GLfloat x, GLfloat y, NSSize siz)
void resetGui:withInfo:(GuiDisplayGen *gui, [withInfo] NSDictionary *gui_info)
static void drawScannerGrid(GLfloat x, GLfloat y, GLfloat z, NSSize siz, int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
void OODrawStringAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
void refreshLastTransmitter()
void OOStartDrawingStrings()
void drawIconForEmptyPylonAtX:y:width:height:alpha:(int x, [y] int y, [width] GLfloat width, [height] GLfloat height, [alpha] GLfloat alpha)
BOOL cloakIndicatorOnStatusLight
NSMutableArray * mfdArray
BOOL minimalisticScanner()
NSDictionary * _crosshairOverrides
static void GLDrawNonlinearCascadeWeapon(GLfloat x, GLfloat y, GLfloat z, NSSize siz, Vector centre, GLfloat radius, GLfloat zoom, GLfloat alpha)
static void prefetchData(NSDictionary *info, struct CachedInfo *data)
void drawCompassSunBlipAt:Size:Alpha:(Vector relativePosition, [Size] NSSize siz, [Alpha] GLfloat alpha)
static GLfloat drawCharacterQuad(uint8_t chr, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
void OODrawHilightedString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
NSMutableArray * dialArray
BOOL minimalistic_scanner
void drawHUDItem:(NSDictionary *info)
OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
void clearHiddenSelectors()
BOOL checkPlayerInFlight()
void drawHighlight(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat alpha)
static void hudDrawMarkerAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
NSMutableDictionary * propertiesReticleTargetSensitive
void drawLegend:(NSDictionary *info)
CGFloat OOStringWidthInEm(NSString *text)
BOOL reticleTargetSensitive
NSMutableArray * legendArray
static void hudDrawReticleOnTarget(Entity *target, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive, BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
void drawSurroundInternal:color:(NSDictionary *info, [color] const GLfloat[4] color)
void OODrawString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
static void hudDrawWaypoint(OOWaypointEntity *waypoint, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL selected, GLfloat scale)
void OODrawPlanetInfo(int gov, int eco, int tec, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
void drawDirectionCue:(NSDictionary *info)
float fov:(BOOL inFraction)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
OOColor * colorFromString:(NSString *colorFloatString)
OOColor * colorWithDescription:(id description)
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
NSStringEncoding encoding()
NSData * convertString:(NSString *string)
void blitCentredToX:Y:Z:alpha:(float x,[Y] float y,[Z] float z,[alpha] float a)
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)
void drawTrumble:(double z)
OOColor * scannerDisplayColor2()
GLfloat * scannerDisplayColorForShip:scannerDisplayColor1:scannerDisplayColor2:(BOOL flash,[scannerDisplayColor1] OOColor *scannerDisplayColor1,[scannerDisplayColor2] OOColor *scannerDisplayColor2)
OOColor * scannerDisplayColor1()
id weakRefUnderlyingObject()
NSMutableArray * targetMemory()
Vector customViewUpVector
Vector customViewForwardVector
double clockTimeAdjusted()
NSDictionary * whitelistDictionary()
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)
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
NSString * scanDescription()
OOColor * scannerDisplayColorHostile2()
OOColor * scannerDisplayColorHostile1()
void setMessageTime:(double value)
OOColor * scannerDisplayColor1()
double estimatedArrivalTime()
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque