53#define ONE_SIXTEENTH 0.0625
54#define ONE_SIXTYFOURTH 0.015625
55#define DEFAULT_OVERALL_ALPHA 0.75
56#define GLYPH_SCALE_FACTOR 0.13
57#define IDENTIFY_SCANNER_LOLLIPOPS ( 0 && OOLITE_DEBUG)
60#define NOT_DEFINED INFINITY
63#define WIDGET_SELECTOR 2
64#define WIDGET_SELECTOR_NAME 3
67#define DO_SET_COLOR(t,d) SetGLColourFromInfo(info,t,d,alpha)
68#define SET_COLOR(d) DO_SET_COLOR(COLOR_KEY,d)
69#define SET_COLOR_LOW(d) DO_SET_COLOR(COLOR_KEY_LOW,d)
70#define SET_COLOR_MEDIUM(d) DO_SET_COLOR(COLOR_KEY_MEDIUM,d)
71#define SET_COLOR_HIGH(d) DO_SET_COLOR(COLOR_KEY_HIGH,d)
72#define SET_COLOR_CRITICAL(d) DO_SET_COLOR(COLOR_KEY_CRITICAL,d)
73#define SET_COLOR_SURROUND(d) DO_SET_COLOR(COLOR_KEY_SURROUND,d)
89static void DrawSpecialOval(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat step, GLfloat* color4v);
96static void hudDrawBarAt(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat amount);
100 GLfloat
alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive,
101 BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors);
104static void drawScannerGrid(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz,
int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic);
118@interface HeadUpDisplay (Private)
125- (void) drawLegend:(NSDictionary *)info;
126- (void) drawHUDItem:(NSDictionary *)info;
128- (void) drawScanner:(NSDictionary *)info;
129- (void) drawScannerZoomIndicator:(NSDictionary *)info;
131- (void) drawCompass:(NSDictionary *)info;
132- (void) drawCompassPlanetBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha;
133- (void) drawCompassStationBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha;
134- (void) drawCompassSunBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha;
135- (void) drawCompassTargetBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha;
136- (void) drawCompassBeaconBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha;
138- (void) drawAegis:(NSDictionary *)info;
139- (void) drawSpeedBar:(NSDictionary *)info;
140- (void) drawRollBar:(NSDictionary *)info;
141- (void) drawPitchBar:(NSDictionary *)info;
142- (void) drawYawBar:(NSDictionary *)info;
143- (void) drawEnergyGauge:(NSDictionary *)info;
144- (void) drawForwardShieldBar:(NSDictionary *)info;
145- (void) drawAftShieldBar:(NSDictionary *)info;
146- (void) drawFuelBar:(NSDictionary *)info;
147- (void) drawWitchspaceDestination:(NSDictionary *)info;
148- (void) drawCabinTempBar:(NSDictionary *)info;
149- (void) drawWeaponTempBar:(NSDictionary *)info;
150- (void) drawAltitudeBar:(NSDictionary *)info;
151- (void) drawMissileDisplay:(NSDictionary *)info;
152- (void) drawTargetReticle:(NSDictionary *)info;
153- (void) drawSecondaryTargetReticle:(NSDictionary *)info;
154- (void) drawWaypoints:(NSDictionary *)info;
155- (void) drawStatusLight:(NSDictionary *)info;
156- (void) drawDirectionCue:(NSDictionary *)info;
157- (void) drawClock:(NSDictionary *)info;
158- (void) drawPrimedEquipmentText:(NSDictionary *)info;
159- (void) drawASCTarget:(NSDictionary *)info;
160- (void) drawWeaponsOfflineText:(NSDictionary *)info;
161- (void) drawMultiFunctionDisplay:(NSDictionary *)info withText:(NSString *)text asIndex:(NSUInteger)index;
162- (void) drawFPSInfoCounter:(NSDictionary *)info;
163- (void) drawScoopStatus:(NSDictionary *)info;
164- (void) drawStickSensitivityIndicator:(NSDictionary *)info;
165- (void) drawCustomBar:(NSDictionary *)info;
166- (void) drawCustomText:(NSDictionary *)info;
167- (void) drawCustomIndicator:(NSDictionary *)info;
168- (void) drawCustomLight:(NSDictionary *)info;
169- (void) drawCustomImage:(NSDictionary *)info;
171- (void) drawSurroundInternal:(NSDictionary *)info color:(const GLfloat[4])color;
172- (void) drawSurround:(NSDictionary *)info;
173- (void) drawGreenSurround:(NSDictionary *)info;
174- (void) drawYellowSurround:(NSDictionary *)info;
176- (void) drawTrumbles:(NSDictionary *)info;
178- (NSArray *) crosshairDefinitionForWeaponType:(
OOWeaponType)weapon;
183- (void) resetGui:(
GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info;
184- (void) resetGuiPosition:(
GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info;
192static const GLfloat
red_color[4] = {1.0, 0.0, 0.0, 1.0};
207static GLfloat drawCharacterQuad(uint8_t chr, GLfloat
x, GLfloat
y, GLfloat z, NSSize siz);
209static void InitTextEngine(
void);
211static void prefetchData(NSDictionary *info,
struct CachedInfo *data);
214OOINLINE void GLColorWithOverallAlpha(
const GLfloat *color, GLfloat alpha)
217 glColor4f(color[0], color[1], color[2], color[3] * alpha);
221- (id) initWithDictionary:(NSDictionary *)hudinfo
223 return [
self initWithDictionary:hudinfo inFile:nil];
227- (id) initWithDictionary:(NSDictionary *)hudinfo inFile:(NSString *)hudFileName
230 BOOL isCompassToBeDrawn = NO;
231 BOOL areTrumblesToBeDrawn = NO;
239 deferredHudName =
nil;
240 hudName = [hudFileName copy];
243 dialArray = [[NSMutableArray alloc] initWithCapacity:16];
244 legendArray = [[NSMutableArray alloc] initWithCapacity:16];
245 mfdArray = [[NSMutableArray alloc] initWithCapacity:8];
247 _reticleColors =
nil;
250 NSArray *dials = [hudinfo oo_arrayForKey:DIALS_KEY];
251 for (i = 0; i < [dials count]; i++)
253 NSDictionary *dial_info = [dials oo_dictionaryAtIndex:i];
254 if (!areTrumblesToBeDrawn && [[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawTrumbles:"]) areTrumblesToBeDrawn = YES;
255 if (!isCompassToBeDrawn && [[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawCompass:"]) isCompassToBeDrawn = YES;
256 if ([[dial_info oo_stringForKey:
SELECTOR_KEY] isEqualToString:
@"drawTargetReticle:"])
258 _reticleColors = [[NSMutableArray arrayWithObjects:[
OOColor colorWithDescription:[dial_info oo_objectForKey:@"target_rgba" defaultValue:@"greenColor"]],
263 [
self addDial:dial_info];
272 if (!areTrumblesToBeDrawn)
274 NSDictionary *trumble_dial_info = [NSDictionary dictionaryWithObjectsAndKeys: @"drawTrumbles:", SELECTOR_KEY, nil];
275 [
self addDial:trumble_dial_info];
278 _compassActive = isCompassToBeDrawn;
280 _lastWeaponType =
nil;
282 NSArray *legends = [hudinfo oo_arrayForKey:LEGENDS_KEY];
283 for (i = 0; i < [legends count]; i++)
285 [
self addLegend:[legends oo_dictionaryAtIndex:i]];
288 NSArray *mfds = [hudinfo oo_arrayForKey:MFDS_KEY];
289 for (i = 0; i < [mfds count]; i++)
291 [
self addMFD:[mfds oo_dictionaryAtIndex:i]];
297 _hiddenSelectors = [[NSMutableSet alloc] initWithCapacity:16];
301 overallAlpha = [hudinfo oo_floatForKey:@"overall_alpha" defaultValue:DEFAULT_OVERALL_ALPHA];
303 reticleTargetSensitive = [hudinfo oo_boolForKey:@"reticle_target_sensitive" defaultValue:NO];
304 propertiesReticleTargetSensitive = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
305 [NSNumber numberWithBool:YES], @"isAccurate",
306 [NSNumber numberWithDouble:[UNIVERSE getTime]], @"timeLastAccuracyProbabilityCalculation",
309 cloakIndicatorOnStatusLight = [hudinfo oo_boolForKey:@"cloak_indicator_on_status_light" defaultValue:YES];
311 allowBigGui = [hudinfo oo_boolForKey:@"allow_big_gui" defaultValue:NO];
315 [crosshairDefinition release];
317 NSString *crossfile = [[hudinfo oo_stringForKey:@"crosshair_file"] retain];
318 if (crossfile ==
nil)
320 _crosshairOverrides = [[hudinfo oo_dictionaryForKey:@"crosshairs"] retain];
321 crosshairDefinition =
nil;
325 [
self setCrosshairDefinition:crossfile];
329 id crosshairColor = [hudinfo oo_objectForKey:@"crosshair_color" defaultValue:@"greenColor"];
331 _crosshairScale = [hudinfo oo_floatForKey:@"crosshair_scale" defaultValue:32.0f];
332 _crosshairWidth = [hudinfo oo_floatForKey:@"crosshair_width" defaultValue:1.5f];
334 minimalistic_scanner = [hudinfo oo_boolForKey:@"scanner_minimalistic" defaultValue:NO];
336 nonlinear_scanner = [hudinfo oo_boolForKey:@"scanner_non_linear" defaultValue:NO];
337 scanner_ultra_zoom = [hudinfo oo_boolForKey:@"scanner_ultra_zoom" defaultValue:NO];
350 DESTROY(propertiesReticleTargetSensitive);
363- (void) resetGui:(
GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info
365 [
self resetGuiPosition:gui withInfo:gui_info];
367 NSSize siz = [gui
size];
369 NSString* title = [gui
title];
371 siz.width = [gui_info oo_floatForKey:WIDTH_KEY];
373 siz.height = [gui_info oo_floatForKey:HEIGHT_KEY];
375 rht = [gui_info oo_floatForKey:ROW_HEIGHT_KEY];
377 title = [gui_info oo_stringForKey:TITLE_KEY];
382 [gui
setMaxAlpha: OOClamp_0_max_f([gui_info oo_floatForKey:ALPHA_KEY],1.0f)];
388- (void) resetGuiPosition:(
GuiDisplayGen*)gui withInfo:(NSDictionary *)gui_info
391 if ([gui_info objectForKey:
X_KEY])
392 pos.x = [gui_info oo_floatForKey:X_KEY] +
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] +
398 [gui_info oo_floatForKey:Y_ORIGIN_KEY defaultValue:0.0];
404- (void) resetGuiPositions
409 NSDictionary* gui_info = [hudDict oo_dictionaryForKey:@"message_gui"];
412 [
self resetGuiPosition:gui withInfo:gui_info];
415 gui = [UNIVERSE commLogGUI];
416 gui_info = [hudDict oo_dictionaryForKey:@"comm_log_gui"];
419 [
self resetGuiPosition:gui withInfo:gui_info];
425- (void) resetGuis:(NSDictionary *)info
431 NSDictionary* gui_info = [info oo_dictionaryForKey:@"message_gui"];
432 if (gui && [gui_info
count] > 0)
443 BOOL line1 = ![[lastLines oo_stringAtIndex:0] isEqualToString:@""];
444 [
self resetGui:gui withInfo:gui_info];
446 BOOL permanent = [gui_info oo_boolForKey:@"permanent" defaultValue:NO];
447 [UNIVERSE setPermanentMessageLog:permanent];
449 BOOL automaticBg = [gui_info oo_boolForKey:@"background_automatic" defaultValue:YES];
450 [UNIVERSE setAutoMessageLogBg:automaticBg];
464 fadeTime:(permanent?0.0:[lastLines oo_floatAtIndex:2]) key:nil addToArray:nil];
466 if ([lastLines
count] > 3 && (line1 || ![[lastLines oo_stringAtIndex:3] isEqualToString:
@""]))
470 fadeTime:(permanent?0.0:[lastLines oo_floatAtIndex:5]) key:nil addToArray:nil];
474 if (gui_info !=
nil && [gui_info
count] == 0)
483 [UNIVERSE setPermanentMessageLog:NO];
484 [UNIVERSE setAutoMessageLogBg:YES];
491 gui = [UNIVERSE commLogGUI];
492 gui_info = [info oo_dictionaryForKey:@"comm_log_gui"];
494 if (gui && [gui_info
count] > 0)
496 [UNIVERSE setAutoCommLog:[gui_info oo_boolForKey:@"automatic" defaultValue:YES]];
497 [UNIVERSE setPermanentCommLog:[gui_info oo_boolForKey:@"permanent" defaultValue:NO]];
512 NSArray *cLog = [PLAYER commLog];
513 NSUInteger i, commCount = [cLog count];
515 [
self resetGui:gui withInfo:gui_info];
517 for (i = 0; i < commCount; i++)
524 if (gui_info !=
nil && [gui_info
count] == 0)
527 [UNIVERSE setAutoCommLog:YES];
528 [UNIVERSE setPermanentCommLog:NO];
549- (NSString *) hudName
555- (void) setHudName:(NSString *)newHudName
557 if (newHudName !=
nil)
560 hudName = [newHudName copy];
565- (
OOColor *) reticleColorForIndex:(NSUInteger)idx
567 if (idx < [_reticleColors
count])
569 return [_reticleColors objectAtIndex:idx];
575- (BOOL) setReticleColorForIndex:(NSUInteger)idx toColor:(
OOColor *)newColor
577 if (newColor && idx < [_reticleColors
count])
579 [_reticleColors replaceObjectAtIndex:idx withObject:newColor];
586- (GLfloat) scannerZoom
592- (void) setScannerZoom:(GLfloat)value
594 scanner_zoom = value;
597- (GLfloat) overallAlpha
603- (void) setOverallAlpha:(GLfloat) newAlphaValue
605 overallAlpha = OOClamp_0_1_f(newAlphaValue);
609- (BOOL) reticleTargetSensitive
611 return reticleTargetSensitive;
615- (void) setReticleTargetSensitive:(BOOL) newReticleTargetSensitiveValue
617 reticleTargetSensitive = !!newReticleTargetSensitiveValue;
621- (NSMutableDictionary *) propertiesReticleTargetSensitive
623 return propertiesReticleTargetSensitive;
633- (void) setHidden:(BOOL)newValue
635 hudHidden = !!newValue;
641 return allowBigGui || hudHidden;
645- (BOOL) hasHidden:(NSString *)selectorName
647 if (selectorName ==
nil)
651 return [_hiddenSelectors containsObject:selectorName];
655- (void) setHiddenSelector:(NSString *)selectorName hidden:(BOOL)hide
659 [_hiddenSelectors addObject:selectorName];
663 [_hiddenSelectors removeObject:selectorName];
668- (void) clearHiddenSelectors
670 [_hiddenSelectors removeAllObjects];
674- (BOOL) isCompassActive
676 return _compassActive;
680- (void) setCompassActive:(BOOL)newValue
682 _compassActive = !!newValue;
692- (void) setDeferredHudName:(NSString *)newDeferredHudName
694 [deferredHudName release];
695 deferredHudName = [newDeferredHudName copy];
699- (NSString *) deferredHudName
701 return deferredHudName;
705- (void) addLegend:(NSDictionary *)info
707 NSString *imageName =
nil;
711 NSMutableDictionary *legendDict =
nil;
715 prefetchData(info, &cache);
717 imageName = [info oo_stringForKey:IMAGE_KEY];
718 if (imageName !=
nil)
722 options:kOOTextureDefaultOptions | kOOTextureNoShrink
724 lodBias:kOOTextureDefaultLODBias];
732 imageSize.width = [info oo_floatForKey:WIDTH_KEY defaultValue:imageSize.width];
733 imageSize.height = [info oo_floatForKey:HEIGHT_KEY defaultValue:imageSize.height];
735 legendSprite = [[
OOTextureSprite alloc] initWithTexture:texture size:imageSize];
737 legendDict = [info mutableCopy];
738 [legendDict setObject:legendSprite forKey:SPRITE_KEY];
740 [legendArray addObject:[NSArray arrayWithObjects:legendDict, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
741 [legendDict release];
742 [legendSprite release];
747 [legendArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)], nil]];
753- (void) addDial:(NSDictionary *)info
755 static NSSet *allowedSelectors =
nil;
756 if (allowedSelectors ==
nil)
759 allowedSelectors = [[NSSet alloc] initWithArray:[whitelist oo_arrayForKey:@"hud_dial_methods"]];
762 NSString *selectorString = [info oo_stringForKey:SELECTOR_KEY];
763 if (selectorString ==
nil)
765 OOLogERR(
@"hud.dial.noSelector",
@"HUD dial in %@ is missing selector.", hudName);
769 if (![allowedSelectors containsObject:selectorString])
771 OOLogERR(
@"hud.dial.invalidSelector",
@"HUD dial in %@ uses selector \"%@\
" which is not in whitelist, and will be ignored.", hudName, selectorString);
775 SEL selector = NSSelectorFromString(selectorString);
777 NSAssert2([
self respondsToSelector:selector],
@"HUD dial in %@ uses selector \"%@\
" which is in whitelist, but not implemented.", hudName, selectorString);
780 if (![
self respondsToSelector:selector])
782 OOLogERR(
@"hud.dial.invalidSelector",
@"HUD dial in %@ uses selector \"%@\
" which is in whitelist, but not implemented, and will be ignored.", hudName, selectorString);
788 prefetchData(info, &cache);
790 [dialArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)],
791 [NSValue valueWithPointer:selector], selectorString, nil]];
795- (void) addMFD:(NSDictionary *)info
798 prefetchData(info, &cache);
799 [mfdArray addObject:[NSArray arrayWithObjects:info, [NSValue valueWithBytes:&cache objCType:@encode(struct CachedInfo)],nil]];
803- (NSUInteger) mfdCount
805 return [mfdArray count];
841 if (_crosshairWidth * lineWidth > 0)
844 [
self drawCrosshairs];
868 z1 = [[UNIVERSE gameView] display_z];
869 NSUInteger i, nLegends = [legendArray count];
870 for (i = 0; i < nLegends; i++)
873 [
self drawLegend:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
880 z1 = [[UNIVERSE gameView] display_z];
885 NSUInteger i, nDials = [dialArray count];
886 for (i = 0; i < nDials; i++)
889 [
self drawHUDItem:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO]];
896 [PLAYER doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:[NSNull null], OOStringFromCompassMode([PLAYER compassMode]), nil]];
904 NSUInteger i, nMFDs = [mfdArray count];
905 NSString *text =
nil;
906 for (i = 0; i < nMFDs; i++)
908 text = [PLAYER multiFunctionText:i];
912 [
self drawMultiFunctionDisplay:[sCurrentDrawItem oo_dictionaryAtIndex:WIDGET_INFO] withText:text asIndex:i];
920 OOViewID viewID = [UNIVERSE viewDirection];
922 BOOL weaponsOnline = [PLAYER weaponsOnline];
923 NSArray *points =
nil;
925 if (viewID == VIEW_CUSTOM ||
926 overallAlpha == 0.0f ||
927 !([
PLAYER status] == STATUS_IN_FLIGHT || [
PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
935 if (weapon != _lastWeaponType || overallAlpha != _lastOverallAlpha || weaponsOnline != _lastWeaponsOnline)
940 if (_crosshairs ==
nil)
942 GLfloat useAlpha = weaponsOnline ? overallAlpha : overallAlpha * 0.5f;
945 points = [
self crosshairDefinitionForWeaponType:weapon];
947 _crosshairs = [[
OOCrosshairs alloc] initWithPoints:points
948 scale:_crosshairScale
949 color:_crosshairColor
950 overallAlpha:useAlpha];
951 _lastWeaponType = weapon;
952 _lastOverallAlpha = useAlpha;
953 _lastWeaponsOnline = weaponsOnline;
956 [_crosshairs render];
960- (NSString *) crosshairDefinition
962 return crosshairDefinition;
966- (BOOL) setCrosshairDefinition:(NSString *)newDefinition
969 [_crosshairs release];
972 [_crosshairOverrides release];
976 if (_crosshairOverrides ==
nil || [_crosshairOverrides
count] == 0)
978 [_crosshairOverrides release];
982 crosshairDefinition =
@"crosshairs.plist";
985 crosshairDefinition = [newDefinition copy];
990- (NSArray *) crosshairDefinitionForWeaponType:(
OOWeaponType)weapon
992 NSString *weaponName =
nil;
993 NSString *weaponName2 =
nil;
994 static NSDictionary *crosshairDefs =
nil;
995 NSArray *result =
nil;
1005 weaponName2 = [weaponName substringFromIndex:3];
1006 result = [_crosshairOverrides oo_arrayForKey:weaponName];
1009 result = [_crosshairOverrides oo_arrayForKey:weaponName2];
1011 if (result ==
nil) result = [_crosshairOverrides oo_arrayForKey:@"OTHER"];
1014 if (crosshairDefs ==
nil)
1019 [crosshairDefs retain];
1022 result = [crosshairDefs oo_arrayForKey:weaponName];
1025 result = [crosshairDefs oo_arrayForKey:weaponName2];
1027 if (result ==
nil) result = [crosshairDefs oo_arrayForKey:@"OTHER"];
1034- (void) drawLegend:(NSDictionary *)info
1037 NSString *equipmentRequired = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
1038 if (equipmentRequired !=
nil && ![
PLAYER hasEquipmentItemProviding:equipmentRequired])
1044 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1049 if (~alertMask & (1 << alertCondition)) {
1054 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1056 if (viewOnly && [
PLAYER guiScreen] != GUI_SCREEN_MAIN)
1068 NSString *legendText =
nil;
1071 GLfloat alpha = overallAlpha;
1074 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1080 alpha *= cached.
alpha;
1082 legendSprite = [info objectForKey:SPRITE_KEY];
1083 if (legendSprite !=
nil)
1089 legendText = [info oo_stringForKey:TEXT_KEY];
1090 if (legendText !=
nil)
1096 if ([info oo_intForKey:
@"align"] == 1)
1109- (void) drawHUDItem:(NSDictionary *)info
1111 NSString *equipment = [info oo_stringForKey:EQUIPMENT_REQUIRED_KEY];
1113 if (equipment !=
nil && ![
PLAYER hasEquipmentItemProviding:equipment])
1119 NSUInteger alertMask = [info oo_unsignedIntForKey:ALERT_CONDITIONS_KEY defaultValue:15];
1124 if (~alertMask & (1 << alertCondition)) {
1129 BOOL viewOnly = [info oo_boolForKey:VIEWSCREEN_KEY defaultValue:NO];
1132 if (viewOnly && [
PLAYER guiScreen] != GUI_SCREEN_MAIN)
1143 [
self performSelector:[(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_SELECTOR] pointerValue] withObject:info];
1152 return [PLAYER isInSpace] && [PLAYER status] != STATUS_DOCKING;
1159 OOPlanetEntity *the_planet = [UNIVERSE planet];
1161 return [
self checkPlayerInFlight]
1162 && the_sun && the_planet
1167static void prefetchData(NSDictionary *info,
struct CachedInfo *data)
1169 data->
x = [info oo_floatForKey:X_KEY defaultValue:NOT_DEFINED];
1170 data->
x0 = [info oo_floatForKey:X_ORIGIN_KEY defaultValue:0.0];
1171 data->
y = [info oo_floatForKey:Y_KEY defaultValue:NOT_DEFINED];
1172 data->
y0 = [info oo_floatForKey:Y_ORIGIN_KEY defaultValue:0.0];
1173 data->
width = [info oo_floatForKey:WIDTH_KEY defaultValue:NOT_DEFINED];
1174 data->
height = [info oo_floatForKey:HEIGHT_KEY defaultValue:NOT_DEFINED];
1175 data->
alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f];
1180- (void) drawScanner:(NSDictionary *)info
1184 GLfloat scanner_color[4] = { 1.0, 0.0, 0.0, 1.0 };
1186 BOOL emptyDial = ([info oo_floatForKey:ALPHA_KEY] == 0.0f);
1188 BOOL isHostile = NO;
1190 BOOL inColorBlindMode = [UNIVERSE colorblindMode] !=
OO_POSTFX_NONE;
1196 scanner_color[3] = 0.0;
1197 siz = NSMakeSize(1.0, 1.0);
1203 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1212 scanner_color[3] *= overallAlpha;
1215 GLfloat alpha = scanner_color[3];
1216 GLfloat col[4] = { 1.0, 1.0, 1.0, alpha };
1218 GLfloat z_factor = siz.height / siz.width;
1219 GLfloat y_factor = 1.0 - sqrt(z_factor);
1226 GLfloat zoom = scanner_zoom;
1227 if (scanner_ultra_zoom)
1228 zoom = pow(2, zoom - 1.0);
1230 if (!nonlinear_scanner)
1232 max_zoomed_range2 /= zoom * zoom;
1234 GLfloat max_zoomed_range = sqrt(max_zoomed_range2);
1238 OOMatrix rotMatrix = [PLAYER rotationMatrix];
1239 Vector relativePosition;
1240 int flash = ((
int)([UNIVERSE getTime] * 4))&1;
1243 int ent_count =
UNIVERSE->n_entities;
1245 Entity *my_entities[ent_count];
1248 for (i = 0; i < ent_count; i++)
1250 my_entities[i] = [uni_entities[i] retain];
1255 OOGL(glColor4fv(scanner_color));
1259 if ([
self checkPlayerInFlight])
1261 GLfloat upscale = zoom * 1.25 / scannerFootprint;
1262 GLfloat max_blip = 0.0;
1278 for (i = 0; i < ent_count; i++)
1280 scannedEntity = my_entities[i];
1285 if (
EXPECT_NOT(drawClass == CLASS_PLAYER || ([scannedEntity isShip] && [(
ShipEntity *)scannedEntity isCloaked])))
1287 drawClass = CLASS_NO_DRAW;
1290 if (drawClass != CLASS_NO_DRAW)
1293 float ms_blip = 0.0;
1295 if (emptyDial)
continue;
1302 GLfloat lim_dist = act_dist - scannedEntity->collision_radius;
1305 if (act_dist > max_zoomed_range + 10000.0)
1308 if (lim_dist > max_zoomed_range)
1313 if ([scannedEntity isShip])
1315 if (ms_blip > max_blip)
1320 ms_blip -= floor(ms_blip);
1322 relativePosition = [PLAYER vectorTo:scannedEntity];
1323 double fuzz = [PLAYER scannerFuzziness];
1324 if (fuzz > 0 && ![[
UNIVERSE gameController] isGamePaused])
1329 Vector rp = relativePosition;
1331 if (act_dist > max_zoomed_range)
1332 scale_vector(&relativePosition, max_zoomed_range / act_dist);
1336 Vector rrp = relativePosition;
1338 if (nonlinear_scanner)
1344 scale_vector(&relativePosition, upscale);
1347 x1 = relativePosition.x;
1348 y1 = z_factor * relativePosition.z;
1349 y2 = y1 + y_factor * relativePosition.
y;
1352 if ([scannedEntity isShip])
1356 GLfloat *base_col = [ship scannerDisplayColorForShip:PLAYER :isHostile :flash
1360 col[0] = base_col[0]; col[1] = base_col[1]; col[2] = base_col[2]; col[3] = alpha * base_col[3];
1362 else if ([scannedEntity isVisualEffect])
1366 col[0] = base_col[0]; col[1] = base_col[1]; col[2] = base_col[2]; col[3] = alpha * base_col[3];
1369 if ([scannedEntity isWormhole])
1375 x1 += scanner_cx; y1 += scanner_cy; y2 += scanner_cy;
1377 if ([scannedEntity isShip])
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);
1393 for (i = 0; i < 6; i++)
1396 if (nonlinear_scanner)
1402 scale_vector(&bounds[i], upscale);
1404 bounds[i] = make_vector(bounds[i].
x + scanner_cx, bounds[i].z * z_factor + bounds[i].
y * y_factor + scanner_cy, z1 );
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);
1422 DrawSpecialOval(x1 - 0.5, y2 + 1.5, z1, NSMakeSize(16.0 * (1.0 - ms_blip), 8.0 * (1.0 - ms_blip)), 30, col);
1424 if ([scannedEntity isCascadeWeapon])
1426 if (nonlinear_scanner)
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;
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);
1440 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
1447#if IDENTIFY_SCANNER_LOLLIPOPS
1448 if ([scannedEntity isShip])
1450 glColor4f(1.0, 1.0, 0.5, alpha);
1455 if (inColorBlindMode && isHostile)
1459 glVertex3f(x1+2, y2+3, z1); glVertex3f(x1-3, y2, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1-3, y2+3, z1);
1465 glVertex3f(x1-3, y2, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1+2, y2+3, z1); glVertex3f(x1-3, y2+3, z1);
1471 glVertex3f(x1, y1, z1); glVertex3f(x1+2, y1, z1); glVertex3f(x1+2, y2, z1); glVertex3f(x1, y2, z1);
1479 for (i = 0; i < ent_count; i++)
1481 [my_entities[i] release];
1489- (BOOL) minimalisticScanner
1491 return minimalistic_scanner;
1495- (void) setMinimalisticScanner: (BOOL) newValue
1497 minimalistic_scanner = !!newValue;
1501+ (Vector) nonlinearScannerScale: (Vector) V Zoom:(GLfloat)zoom Scale:(
double) scale
1504 Vector unit = vector_normal(V);
1509- (BOOL) nonlinearScanner
1511 return nonlinear_scanner;
1515- (void) setNonlinearScanner: (BOOL) newValue
1517 nonlinear_scanner = !!newValue;
1521- (BOOL) scannerUltraZoom
1523 return scanner_ultra_zoom;
1527- (void) setScannerUltraZoom: (BOOL) newValue
1529 scanner_ultra_zoom = !!newValue;
1533- (void) refreshLastTransmitter
1535 Entity* lt = [UNIVERSE entityForUniversalID:last_transmitter];
1539 if ([st messageTime] <= 0.0)
1544- (void) drawScannerZoomIndicator:(NSDictionary *)info
1549 GLfloat zoom_color[4] = { 1.0f, 0.1f, 0.0f, 1.0f };
1552 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1560 zoom_color[3] *= overallAlpha;
1561 alpha = zoom_color[3];
1563 GLfloat cx =
x - 0.3 * siz.width;
1564 GLfloat cy =
y - 0.75 * siz.height;
1566 int zl = scanner_zoom;
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];
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);
1585 OOGL(glDisable(GL_TEXTURE_2D));
1589- (void) drawCompass:(NSDictionary *)info
1594 GLfloat compass_color[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
1597 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1605 compass_color[3] *= overallAlpha;
1606 alpha = compass_color[3];
1609 OOMatrix rotMatrix = [PLAYER rotationMatrix];
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;
1616 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], alpha));
1618 OOGL(glColor4f(compass_color[0], compass_color[1], compass_color[2], 0.5f * alpha));
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);
1627 if ([
self checkPlayerInSystemFlight] && [
PLAYER status] != STATUS_LAUNCHING)
1629 Entity *reference = [PLAYER compassTarget];
1633 Vector relativePosition = [PLAYER vectorTo:reference];
1635 relativePosition = vector_normal_or_fallback(relativePosition,
kBasisZVector);
1637 relativePosition.x *= siz.width * 0.4;
1638 relativePosition.y *= siz.height * 0.4;
1639 relativePosition.x +=
x;
1640 relativePosition.y +=
y;
1645 switch ([
PLAYER compassMode])
1647 case COMPASS_MODE_INACTIVE:
1650 case COMPASS_MODE_BASIC:
1651 if ([reference isStation])
1652 [
self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1654 [
self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1657 case COMPASS_MODE_PLANET:
1658 [
self drawCompassPlanetBlipAt:relativePosition Size:siz Alpha:alpha];
1661 case COMPASS_MODE_STATION:
1662 [
self drawCompassStationBlipAt:relativePosition Size:siz Alpha:alpha];
1665 case COMPASS_MODE_SUN:
1666 [
self drawCompassSunBlipAt:relativePosition Size:siz Alpha:alpha];
1669 case COMPASS_MODE_TARGET:
1670 [
self drawCompassTargetBlipAt:relativePosition Size:siz Alpha:alpha];
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];
1682 _compassActive = YES;
1687OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
1689 if (relativeZ >= 0.0f)
1691 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1695 OOGL(glColor4f(1.0f, 0.0f, 0.0f, alpha));
1700- (void) drawCompassPlanetBlipAt:(Vector)relativePosition Size:(NSSize)siz Alpha:(GLfloat)alpha
1702 if (relativePosition.z >= 0)
1704 OOGL(glColor4f(0.0,1.0,0.0,0.75 * alpha));
1706 OOGL(glColor4f(0.0,1.0,0.0,alpha));
1707 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1711 OOGL(glColor4f(1.0,0.0,0.0,alpha));
1712 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1717- (void) drawCompassStationBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1719 SetCompassBlipColor(relativePosition.z, alpha);
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);
1730- (void) drawCompassSunBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1732 OOGL(glColor4f(1.0, 1.0, 0.0, 0.75 * alpha));
1735 SetCompassBlipColor(relativePosition.z, alpha);
1737 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1741- (void) drawCompassTargetBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1743 SetCompassBlipColor(relativePosition.z, alpha);
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);
1752 GLDrawOval(relativePosition.x, relativePosition.y, z1, siz, 30);
1756- (void) drawCompassBeaconBlipAt:(Vector) relativePosition Size:(NSSize) siz Alpha:(GLfloat) alpha
1758 SetCompassBlipColor(relativePosition.z, alpha);
1769 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1770 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1772 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1773 glVertex3f(relativePosition.x, relativePosition.y + 0.6 * siz.height, z1);
1775 glVertex3f(relativePosition.x + 0.6 * siz.width, relativePosition.y, z1);
1776 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1778 glVertex3f(relativePosition.x - 0.6 * siz.width, relativePosition.y, z1);
1779 glVertex3f(relativePosition.x, relativePosition.y - 0.6 * siz.height, z1);
1785- (void) drawAegis:(NSDictionary *)info
1792 GLfloat alpha = 0.5f * overallAlpha;
1795 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1801 alpha *= cached.
alpha;
1805 GLfloat w = siz.width / 16.0;
1806 GLfloat h = siz.height / 16.0;
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 };
1811 OOGL(glColor4f(0.0f, 1.0f, 0.0f, alpha));
1814 for (i = 0; i < 32; i += 2)
1816 glVertex3f(
x + w * strip[i],
y - h * strip[i + 1], z1);
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));
1829 OOGL(glDrawArrays(GL_QUAD_STRIP, 0,
sizeof strip /
sizeof *strip / 2));
1830 OOGL(glDisableClientState(GL_VERTEX_ARRAY));
1837- (void) drawCustomBar:(NSDictionary *)info
1842 GLfloat alpha = overallAlpha;
1846 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1852 alpha *= cached.
alpha;
1854 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1880- (void) drawCustomText:(NSDictionary *)info
1884 GLfloat alpha = overallAlpha;
1885 NSString *text = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1888 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1892 alpha *= cached.
alpha;
1899 if ([info oo_intForKey:
@"align"] == 1)
1911- (void) drawCustomIndicator:(NSDictionary *)info
1916 GLfloat alpha = overallAlpha;
1921 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1927 alpha *= cached.
alpha;
1928 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
1942- (void) drawCustomLight:(NSDictionary *)info
1946 GLfloat alpha = overallAlpha;
1950 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1956 alpha *= cached.
alpha;
1958 GLfloat light_color[4] = { 0.25, 0.25, 0.25, 0.0};
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]];
1966 GLColorWithOverallAlpha(light_color, alpha);
1970 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
1977- (void) drawCustomImage:(NSDictionary *)info
1980 GLfloat alpha = overallAlpha;
1984 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
1988 alpha *= cached.
alpha;
1990 NSString *textureFile = [PLAYER dialCustomString:[info oo_stringForKey:CUSTOM_DIAL_KEY]];
1991 if (textureFile ==
nil || [textureFile length] == 0) {
1997 options:kOOTextureDefaultOptions | kOOTextureNoShrink
1999 lodBias:kOOTextureDefaultLODBias];
2023- (void) drawSpeedBar:(NSDictionary *)info
2028 GLfloat alpha = overallAlpha;
2029 GLfloat ds = [PLAYER dialSpeed];
2032 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2038 alpha *= cached.
alpha;
2040 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:SPEED_BAR_DRAW_SURROUND];
2067- (void) drawRollBar:(NSDictionary *)info
2072 GLfloat alpha = overallAlpha;
2075 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2081 alpha *= cached.
alpha;
2082 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:ROLL_BAR_DRAW_SURROUND];
2096- (void) drawPitchBar:(NSDictionary *)info
2101 GLfloat alpha = overallAlpha;
2104 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2110 alpha *= cached.
alpha;
2111 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
2125- (void) drawYawBar:(NSDictionary *)info
2130 GLfloat alpha = overallAlpha;
2133 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2140 alpha *= cached.
alpha;
2141 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:PITCH_BAR_DRAW_SURROUND];
2155- (void) drawEnergyGauge:(NSDictionary *)info
2160 BOOL drawSurround, labelled, energyCritical = NO;
2161 GLfloat alpha = overallAlpha;
2162 GLfloat bankHeight, bankY;
2166 n_bars = [info oo_unsignedIntForKey:N_BARS_KEY defaultValue:n_bars];
2171 GLfloat energy = [player dialEnergy] * n_bars;
2174 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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;
2192 bankHeight = siz.height / n_bars;
2194 NSSize barSize = NSMakeSize(siz.width, bankHeight - 2.0);
2195 GLfloat midBank = bankHeight / 2.0f;
2196 bankY =
y - (n_bars - 1) * midBank - 1.0;
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++)
2206 OODrawString([NSString stringWithFormat:
@"E%x", n_bars - i], labelStartX, bankY - midBank, z1, labelSize);
2207 bankY += bankHeight;
2219 bankY =
y - (n_bars - 1) * midBank;
2220 for (i = 0; i < n_bars; i++)
2226 else if (energy > 0.0)
2232 bankY += bankHeight;
2237- (void) drawForwardShieldBar:(NSDictionary *)info
2242 GLfloat alpha = overallAlpha;
2243 GLfloat shield = [PLAYER dialForwardShield];
2246 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2252 alpha *= cached.
alpha;
2253 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:FORWARD_SHIELD_BAR_DRAW_SURROUND];
2266 else if (shield < .80)
2278- (void) drawAftShieldBar:(NSDictionary *)info
2283 GLfloat alpha = overallAlpha;
2284 GLfloat shield = [PLAYER dialAftShield];
2287 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2293 alpha *= cached.
alpha;
2294 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:AFT_SHIELD_BAR_DRAW_SURROUND];
2307 else if (shield < .80)
2319- (void) drawFuelBar:(NSDictionary *)info
2325 GLfloat alpha = overallAlpha;
2328 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2334 alpha *= cached.
alpha;
2335 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2343 fu = [PLAYER dialFuel];
2344 hr = [PLAYER dialHyperRange];
2351 if (hr > 0.0f && hr <= 1.0f)
2353 if ([
PLAYER hasSufficientFuelForJump])
2367- (void) drawWitchspaceDestination:(NSDictionary *)info
2370 if ([
PLAYER dialHyperRange] == 0.0f)
2377 GLfloat alpha = overallAlpha;
2381 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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];
2394 if ([info oo_intForKey:
@"align"] == 1)
2406- (void) drawCabinTempBar:(NSDictionary *)info
2411 GLfloat temp = [PLAYER hullHeatLevel];
2412 GLfloat alpha = overallAlpha;
2415 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2421 alpha *= cached.
alpha;
2422 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2435 if (temp > .90 && flash)
2453- (void) drawWeaponTempBar:(NSDictionary *)info
2458 GLfloat temp = [PLAYER laserHeatLevel];
2459 GLfloat alpha = overallAlpha;
2462 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2468 alpha *= cached.
alpha;
2469 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2480 else if (temp > .25)
2488- (void) drawAltitudeBar:(NSDictionary *)info
2493 GLfloat alt = [PLAYER dialAltitude];
2494 GLfloat alpha = overallAlpha;
2497 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2503 alpha *= cached.
alpha;
2504 draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:NO];
2518 if (alt < .10 && flash)
2543 static NSMutableDictionary *sIcons =
nil;
2546 result = [sIcons objectForKey:role];
2549 NSString *key = role;
2550 NSArray *iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2551 if (iconDef !=
nil) result = [[
OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2564 iconDef = [[UNIVERSE descriptions] oo_arrayForKey:key];
2565 result = [[
OOPolygonSprite alloc] initWithDataArray:iconDef outlineWidth:kOutlineWidth name:key];
2570 if (sIcons ==
nil) sIcons = [[NSMutableDictionary alloc] init];
2571 [sIcons setObject:result forKey:role];
2580- (void) drawIconForMissile:(
ShipEntity *)missile
2581 selected:(BOOL)selected
2584 width:(GLfloat)width height:(GLfloat)height alpha:(GLfloat)alpha
2609 GLColorWithOverallAlpha(
green_color, alpha);
break;
2613 GLColorWithOverallAlpha(
red_color, alpha);
break;
2618 if ([missile primaryTarget] ==
nil) GLColorWithOverallAlpha(
green_color, alpha);
2619 else GLColorWithOverallAlpha(
red_color, alpha);
2631- (void) drawIconForEmptyPylonAtX:(
int)x y:(
int)y
2632 width:(GLfloat)width height:(GLfloat)height alpha:(GLfloat)alpha
2646- (void) drawMissileDisplay:(NSDictionary *)info
2650 GLfloat alpha = overallAlpha;
2653 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2659 alpha *= cached.
alpha;
2660 sp = [info oo_unsignedIntForKey:SPACING_KEY defaultValue:MISSILES_DISPLAY_SPACING];
2662 BOOL weaponsOnline = [PLAYER weaponsOnline];
2663 if (!weaponsOnline) alpha *= 0.2f;
2665 if (![
PLAYER dialIdentEngaged])
2668 NSUInteger i, n_mis = [PLAYER dialMaxMissiles];
2669 for (i = 0; i < n_mis; i++)
2671 ShipEntity *missile = [PLAYER missileForPylon:i];
2674 [
self drawIconForMissile:missile
2675 selected:weaponsOnline && i == [PLAYER activeMissile]
2677 x:x + (int)i * sp + 2 y:y
2678 width:siz.width * 0.25f height:siz.height * 0.25f
2683 [
self drawIconForEmptyPylonAtX:x + (int)i * sp + 2 y:y
2684 width:siz.width * 0.25f height:siz.height * 0.25f alpha:alpha];
2691 y -= siz.height * 0.75;
2694 switch ([
PLAYER dialMissileStatus])
2697 GLColorWithOverallAlpha(
green_color, alpha);
break;
2701 GLColorWithOverallAlpha(
red_color, alpha);
break;
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);
2716- (void) drawTargetReticle:(NSDictionary *)info
2718 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2723 [
self drawDirectionCue:info];
2726 if ([
PLAYER hasEquipmentItemProviding:
@"EQ_INTEGRATED_TARGETING_SYSTEM"])
2728 [
self drawSecondaryTargetReticle:info];
2733- (void) drawSecondaryTargetReticle:(NSDictionary *)info
2735 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha * 0.4;
2738 if ([player hasEquipmentItemProviding:
@"EQ_TARGET_MEMORY"])
2746 id sec_id = [targetMemory objectAtIndex:i];
2752 if (sec_id !=
nil && [sec_id isProxy])
2755 if (secondary !=
nil && secondary != primary)
2768- (void) drawWaypoints:(NSDictionary *)info
2770 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
2771 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
2773 NSEnumerator *waypoints = [[UNIVERSE currentWaypoints] objectEnumerator];
2775 Entity *compass = [PLAYER compassTarget];
2777 while ((waypoint = [waypoints nextObject]))
2785- (void) drawStatusLight:(NSDictionary *)info
2789 GLfloat alpha = overallAlpha;
2790 BOOL blueAlert = cloakIndicatorOnStatusLight && [PLAYER isCloaked];
2793 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2799 alpha *= cached.
alpha;
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));
2805 switch(alertCondition)
2829 status_color[3] = flash_alpha;
2830 GLColorWithOverallAlpha(status_color, alpha);
2834 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
2841- (void) drawDirectionCue:(NSDictionary *)info
2843 GLfloat alpha = overallAlpha;
2846 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2848 alpha *= cached.
alpha;
2852 Entity *target = [PLAYER primaryTarget];
2853 if (target ==
nil)
return;
2858 rotMatrix = [PLAYER rotationMatrix];
2860 if ([
UNIVERSE viewDirection] != VIEW_GUI_DISPLAY)
2865 const float visMin = 0.994521895368273f;
2866 const float visMax = 0.984807753012208f;
2869 Vector rpn = [PLAYER vectorTo:target];
2871 Vector drawPos = rpn;
2880 drawPos.x = - drawPos.
x;
2884 drawPos.x = drawPos.z;
2887 case VIEW_STARBOARD:
2888 drawPos.x = -drawPos.z;
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);
2905 OOColor *directionCueColor = [_reticleColors objectAtIndex:cueColorIndex];
2906 GLfloat clearColorArray[4] = {[directionCueColor
redComponent],
2910 GLfloat directionCueColorArray[4] = {[directionCueColor
redComponent],
2915 drawPos = vector_normal(drawPos);
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);
2929- (void) drawClock:(NSDictionary *)info
2933 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2936 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2944 itemColor[3] *= overallAlpha;
2946 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2951- (void) drawPrimedEquipment:(NSDictionary *)info
2953 if ([
PLAYER status] == STATUS_DOCKED)
2959 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2962 NSUInteger lines = [info oo_intForKey:@"n_bars" defaultValue:1];
2963 NSInteger pec = (NSInteger)[
PLAYER primedEquipmentCount];
2965 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2983 itemColor[3] *= overallAlpha;
2987 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2988 NSString *equipmentName = [PLAYER primedEquipmentName:0];
2993 NSInteger negative = (lines - 1) / 2;
2994 NSInteger positive = lines / 2;
2995 for (NSInteger i = -negative; i <= positive; i++)
2997 if (i >= -(pec) / 2 && i <= (pec + 1) / 2)
3001 GLfloat alphaScale = 1.0/((i<0)?(1.0-i):(1.0+i));
3002 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]*alphaScale));
3011- (void) drawASCTarget:(NSDictionary *)info
3013 if (!([
self checkPlayerInSystemFlight] && [
PLAYER status] != STATUS_LAUNCHING))
3019 GLfloat itemColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
3022 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3034 itemColor[3] *= overallAlpha;
3036 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
3037 if ([info oo_intForKey:
@"align"] == 1)
3049- (void) drawWeaponsOfflineText:(NSDictionary *)info
3051 OOViewID viewID = [UNIVERSE viewDirection];
3052 GLfloat textColor[4] = {0.0f, 1.0f, 0.0f, 1.0f};
3054 if (viewID == VIEW_CUSTOM ||
3055 overallAlpha == 0.0f ||
3056 !([
PLAYER status] == STATUS_IN_FLIGHT || [
PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
3064 if (![
PLAYER weaponsOnline])
3068 GLfloat alpha = overallAlpha;
3071 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3077 alpha *= cached.
alpha;
3080 textColor[3] *= overallAlpha;
3082 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], textColor[3]));
3089- (void) drawFPSInfoCounter:(NSDictionary *)info
3091 if (![
UNIVERSE displayFPS])
return;
3096 GLfloat textColor[4] = {0.0, 1.0, 0.0, 1.0};
3098 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
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];
3112 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], 1.0f));
3116 NSSize siz08 = NSMakeSize(0.8 * siz.width, 0.8 * siz.width);
3117 NSString *collDebugInfo = [NSString stringWithFormat:@"%@ - %@", [PLAYER dial_objinfo], [UNIVERSE collisionDescription]];
3122 NSString *timeAccelerationFactorInfo = [NSString stringWithFormat:@"TAF: %@%.2f", DESC(@"multiplication-sign"), [UNIVERSE timeAccelerationFactor]];
3123 OODrawString(timeAccelerationFactorInfo,
x,
y - 3.2 * siz08.height, z1, siz08);
3128- (void) drawScoopStatus:(NSDictionary *)info
3135 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3142 alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:0.75f];
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));
3154 switch (scoop_status)
3170 for (i = 0; i < 3; i++)
3172 s1c[i] = s0_color[i];
3173 s2c[i] = s0_color[i];
3174 s3c[i] = s0_color[i];
3184 s1c[3] = alpha * a1;
3185 s2c[3] = alpha * a2;
3186 s3c[3] = alpha * a3;
3195 GLfloat w1 = siz.width / 8.0;
3196 GLfloat w2 = 2.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;
3204 OOGL(glDisable(GL_TEXTURE_2D));
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);
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);
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);
3221- (void) drawStickSensitivityIndicator:(NSDictionary *)info
3225 GLfloat alpha = overallAlpha;
3226 BOOL mouse = [PLAYER isMouseControlOn];
3230 if (![stickHandler joystickCount])
3235 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3241 alpha *= cached.
alpha;
3255 NSSize siz8th = { siz.width / 8, siz.height / 8 };
3262 siz.width -= _crosshairWidth * lineWidth / 2;
3263 siz.height -= _crosshairWidth * lineWidth / 2;
3273- (void) drawSurroundInternal:(NSDictionary *)info color:(const GLfloat[4])color
3277 GLfloat alpha = overallAlpha;
3280 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3287 x = cached.
x + [[
UNIVERSE gameView] x_offset] * cached.
x0;
3288 y = cached.
y + [[
UNIVERSE gameView] y_offset] * cached.
y0;
3291 alpha *= cached.
alpha;
3294 GLColorWithOverallAlpha(color, alpha);
3299- (void) drawSurround:(NSDictionary *)info
3301 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
3302 id colorDesc = [info objectForKey:COLOR_KEY];
3303 if (colorDesc !=
nil)
3314 [
self drawSurroundInternal:info color:itemColor];
3318- (void) drawGreenSurround:(NSDictionary *)info
3320 [
self drawSurroundInternal:info color:green_color];
3324- (void) drawYellowSurround:(NSDictionary *)info
3326 [
self drawSurroundInternal:info color:yellow_color];
3330- (void) drawTrumbles:(NSDictionary *)info
3332 OOTrumble** trumbles = [PLAYER trumbleArray];
3334 for (i = [
PLAYER trumbleCount]; i > 0; i--)
3342- (void) drawMultiFunctionDisplay:(NSDictionary *)info withText:(NSString *)text asIndex:(NSUInteger)index
3348 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3352 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
3354 GLfloat mfd_color[4] = {0.0, 1.0, 0.0, 0.9*alpha};
3360 if (index != [player1 activeMFD])
3362 mfd_color[3] *= 0.75;
3364 [
self drawSurroundInternal:info color:mfd_color];
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;
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);
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);
3385 NSString *line =
nil;
3386 NSArray *lines = [text componentsSeparatedByString:@"\n"];
3388 GLColorWithOverallAlpha(mfd_color, alpha);
3389 for (i = 0; i < 10 ; i++)
3391 line = [lines oo_stringAtIndex:i defaultValue:nil];
3397 if (textwidth <= cached.
width)
3404 tmpsiz.height = siz.height;
3405 tmpsiz.width = siz.width * cached.
width / textwidth;
3420 if (siz.width > siz.height)
3422 GLfloat dial_oy =
y - siz.height/2;
3423 GLfloat position =
x + amount * siz.width / 2;
3425 glVertex3f(position, dial_oy, z);
3426 glVertex3f(position+2,
y, z);
3427 glVertex3f(position, dial_oy+siz.height, z);
3428 glVertex3f(position-2,
y, z);
3433 GLfloat dial_ox =
x - siz.width/2;
3434 GLfloat position =
y + amount * siz.height / 2;
3436 glVertex3f(dial_ox, position, z);
3437 glVertex3f(
x, position+2, z);
3438 glVertex3f(dial_ox + siz.width, position, z);
3439 glVertex3f(
x, position-2, z);
3447 if (siz.width > siz.height)
3449 GLfloat dial_oy =
y - siz.height/2;
3450 GLfloat position =
x + amount * siz.width - siz.width/2;
3452 glVertex3f(position+1, dial_oy+1, z);
3453 glVertex3f(position+1, dial_oy+siz.height-1, z);
3454 glVertex3f(position-1, dial_oy+siz.height-1, z);
3455 glVertex3f(position-1, dial_oy+1, z);
3460 GLfloat dial_ox =
x - siz.width/2;
3461 GLfloat position =
y + amount * siz.height - siz.height/2;
3463 glVertex3f(dial_ox+1, position+1, z);
3464 glVertex3f(dial_ox + siz.width-1, position+1, z);
3465 glVertex3f(dial_ox + siz.width-1, position-1, z);
3466 glVertex3f(dial_ox+1, position-1, z);
3474 GLfloat dial_ox =
x - siz.width/2;
3475 GLfloat dial_oy =
y - siz.height/2;
3476 if (fabs(siz.width) > fabs(siz.height))
3478 GLfloat position = dial_ox + amount * siz.width;
3481 glVertex3f(dial_ox, dial_oy, z);
3482 glVertex3f(position, dial_oy, z);
3483 glVertex3f(position, dial_oy+siz.height, z);
3484 glVertex3f(dial_ox, dial_oy+siz.height, z);
3489 GLfloat position = dial_oy + amount * siz.height;
3492 glVertex3f(dial_ox, dial_oy, z);
3493 glVertex3f(dial_ox, position, z);
3494 glVertex3f(dial_ox+siz.width, position, z);
3495 glVertex3f(dial_ox+siz.width, dial_oy, z);
3503 GLfloat dial_ox =
x - siz.width/2;
3504 GLfloat dial_oy =
y - siz.height/2;
3507 glVertex3f(dial_ox-2, dial_oy-2, z);
3508 glVertex3f(dial_ox+siz.width+2, dial_oy-2, z);
3509 glVertex3f(dial_ox+siz.width+2, dial_oy+siz.height+2, z);
3510 glVertex3f(dial_ox-2, dial_oy+siz.height+2, z);
3517 int ox =
x - siz.width / 2.0;
3518 int oy =
y - siz.height / 2.0;
3519 int w = siz.width / 4.0;
3520 int h = siz.height / 4.0;
3522 glVertex3i(ox, oy + h, z);
3523 glVertex3i(ox, oy + 3 * h, z);
3524 glVertex3i(ox + w, oy + 4 * h, z);
3525 glVertex3i(ox + 3 * w, oy + 4 * h, z);
3526 glVertex3i(ox + 4 * w, oy + 3 * h, z);
3527 glVertex3i(ox + 4 * w, oy + h, z);
3528 glVertex3i(ox + 3 * w, oy, z);
3529 glVertex3i(ox + w, oy, z);
3534 GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive,
3535 BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
3537 if (target ==
nil || player1 ==
nil)
3541 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3547 NSString *legal_desc =
nil;
3549 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
3552 if ([target isShip])
3558 if ([target_ship isCloaked])
return;
3564 p1 = HPVectorToVector(HPvector_subtract([target position], [player1 viewpointPosition]));
3566 GLfloat rdist = magnitude(p1);
3567 GLfloat rsize = [target
collisionRadius] / (2 * [[UNIVERSE gameView] fov:YES]);
3569 if (rsize < rdist * scale)
3570 rsize = rdist * scale;
3572 GLfloat rs0 = rsize;
3573 GLfloat rs2 = rsize * 0.50;
3585 if ([target isWormhole])
3587 OOColor *wormholeReticleColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_WORMHOLE];
3588 GLfloat wormholeReticleColorArray[4] = {[wormholeReticleColor
redComponent],
3592 GLColorWithOverallAlpha(wormholeReticleColorArray, alpha);
3597 BOOL isTargeted = NO;
3598 GLfloat probabilityAccuracy;
3600 if (propertiesReticleTargetSensitive !=
nil)
3603 if (range < [player1 weaponRange])
3609 if ([
UNIVERSE getTime] > [propertiesReticleTargetSensitive oo_doubleForKey:
@"timeLastAccuracyProbabilityCalculation"] + 1)
3614 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithBool:((randf() < probabilityAccuracy) ? YES : NO)] forKey:@"isAccurate"];
3617 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithDouble:[UNIVERSE getTime]] forKey:@"timeLastAccuracyProbabilityCalculation"];
3619 if ([propertiesReticleTargetSensitive oo_boolForKey:
@"isAccurate"])
3622 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3627 isTargeted = ([UNIVERSE firstEntityTargetedByPlayer] == target);
3633 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3646 if (colourFromScannerColour)
3648 if ([target isShip])
3652 GLColorWithOverallAlpha([ship scannerDisplayColorForShip:
PLAYER :isHostile :flash :[ship scannerDisplayColor1] :[ship scannerDisplayColor2] :[ship scannerDisplayColorHostile1] :[ship scannerDisplayColorHostile2]],alpha);
3654 else if ([target isVisualEffect])
3657 GLColorWithOverallAlpha([vis scannerDisplayColorForShip:flash :[vis scannerDisplayColor1] :[vis scannerDisplayColor2]],alpha);
3667 if (reticleTargetSensitive && isTargeted)
3669 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET_SENSITIVE];
3674 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET];
3677 GLfloat reticleDisplayColorArray[4] = { [reticleDisplayColor
redComponent],
3681 GLColorWithOverallAlpha(reticleDisplayColorArray, alpha);
3685 glVertex2f(rs0,rs2); glVertex2f(rs0,rs0);
3686 glVertex2f(rs0,rs0); glVertex2f(rs2,rs0);
3688 glVertex2f(rs0,-rs2); glVertex2f(rs0,-rs0);
3689 glVertex2f(rs0,-rs0); glVertex2f(rs2,-rs0);
3691 glVertex2f(-rs0,rs2); glVertex2f(-rs0,rs0);
3692 glVertex2f(-rs0,rs0); glVertex2f(-rs2,rs0);
3694 glVertex2f(-rs0,-rs2); glVertex2f(-rs0,-rs0);
3695 glVertex2f(-rs0,-rs0); glVertex2f(-rs2,-rs0);
3702 if (range < 0.001f) range = 0.0f;
3703 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3704 float line_height = rdist * scale;
3705 NSString* infoline = [NSString stringWithFormat:@"%0.3f km", range];
3706 if (legal_desc !=
nil) infoline = [NSString stringWithFormat:@"%@ (%@)", infoline, legal_desc];
3708 OODrawString([player1 dialTargetName], rs0, 0.5 * rs2, 0, textsize);
3709 OODrawString(infoline, rs0, 0.5 * rs2 - line_height, 0, textsize);
3711 if ([target isWormhole])
3724 NSString *wormholeETA = [NSString stringWithFormat:DESC(@"wormhole-ETA-@"), ClockToString([(
WormholeEntity *)
target estimatedArrivalTime], NO)];
3725 OODrawString(wormholeETA, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
3730 int minutesToCollapse = floor (timeForCollapsing / 60.0);
3731 int secondsToCollapse = (
int)timeForCollapsing % 60;
3733 NSString *wormholeExpiringIn = [NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
3734 OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
3749 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3755 Vector p1 = HPVectorToVector(HPvector_subtract([waypoint position], [player1 viewpointPosition]));
3763 GLfloat rdist = magnitude(p1);
3764 GLfloat rsize = rdist * scale;
3766 GLfloat rs0 = rsize;
3767 GLfloat rs2 = rsize * 0.50;
3775 GLColorWithOverallAlpha(
blue_color, alpha*0.25);
3779 glVertex2f(rs0,rs2); glVertex2f(rs2,rs2);
3780 glVertex2f(rs2,rs0); glVertex2f(rs2,rs2);
3782 glVertex2f(-rs0,rs2); glVertex2f(-rs2,rs2);
3783 glVertex2f(-rs2,rs0); glVertex2f(-rs2,rs2);
3785 glVertex2f(-rs0,-rs2); glVertex2f(-rs2,-rs2);
3786 glVertex2f(-rs2,-rs0); glVertex2f(-rs2,-rs2);
3788 glVertex2f(rs0,-rs2); glVertex2f(rs2,-rs2);
3789 glVertex2f(rs2,-rs0); glVertex2f(rs2,-rs2);
3797 GLfloat range = HPdistance([player1 position],[waypoint position]) * 0.001f;
3798 if (range < 0.001f) range = 0.0f;
3799 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3800 float line_height = rdist * scale;
3801 NSString* infoline = [NSString stringWithFormat:@"%0.3f km", range];
3802 OODrawString(infoline, rs0 * 0.5, -rs2 - line_height, 0, textsize);
3811 back_q.w = -back_q.w;
3813 NSSize viewSize = [[UNIVERSE gameView] viewSize];
3814 float aspect = viewSize.width / viewSize.height;
3819 float ratio = 2 * [[UNIVERSE gameView] fov:YES];
3820 if (3.0f * aspect >= 4.0f)
3826 OOGLScaleModelView(make_vector((4.0f/3.0f)/(aspect*ratio), (4.0f/3.0f)/(aspect*ratio), 1.0f));
3835 view_dir.x = 0.0; view_dir.y = 0.0; view_dir.z = 1.0;
3839 view_dir.x = 0.0; view_dir.y = 0.0; view_dir.z = -1.0;
3844 view_dir.x = -1.0; view_dir.y = 0.0; view_dir.z = 0.0;
3848 case VIEW_STARBOARD:
3849 view_dir.x = 1.0; view_dir.y = 0.0; view_dir.z = 0.0;
3874static void InitTextEngine(
void)
3876 NSDictionary *fontSpec =
nil;
3877 NSArray *widths =
nil;
3878 NSString *texName =
nil;
3879 NSUInteger i,
count;
3885 texName = [fontSpec oo_stringForKey:@"texture" defaultValue:@"oolite-font.png"];
3893 sF6KernGovt = [fontSpec oo_floatForKey:@"f6KernGovernment" defaultValue:1.0];
3894 sF6KernTL = [fontSpec oo_floatForKey:@"f6KernTechLevel" defaultValue:2.0];
3897 widths = [fontSpec oo_arrayForKey:@"widths"];
3898 count = [widths count];
3900 for (i = 0; i !=
count; ++i)
3914static GLfloat drawCharacterQuad(uint8_t chr, GLfloat
x, GLfloat
y, GLfloat z, NSSize siz)
3918 if (chr > 32 || chr < 31) {
3924 glVertex3f(
x,
y, z);
3926 glVertex3f(
x + siz.width,
y, z);
3928 glVertex3f(
x + siz.width,
y + siz.height, z);
3929 glTexCoord2f(texture_x, texture_y);
3930 glVertex3f(
x,
y + siz.height, z);
3940 const uint8_t *bytes = NULL;
3941 NSUInteger i, length;
3944 bytes = [data bytes];
3945 length = [data length];
3947 for (i = 0; i < length; i++)
3952 return NSMakeRect(
x,
y, w, siz.height);
3965 OOGL(glColor4f(0.0f, 0.0f, 0.0f, alpha * 0.4f));
3969 glVertex3f(
x + 1.0f ,
y + siz.height + 2.5f, z);
3970 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.5f, z);
3971 glVertex3f(
x + siz.width + 4.5f,
y + siz.height + 1.0f, z);
3972 glVertex3f(
x + siz.width + 4.5f,
y + 3.0f, z);
3973 glVertex3f(
x + siz.width + 3.0f,
y + 1.5f, z);
3974 glVertex3f(
x + 1.0f,
y + 1.5f, z);
3975 glVertex3f(
x - 0.5f,
y + 3.0f, z);
3976 glVertex3f(
x - 0.5f,
y + siz.height + 1.0f, z);
3981 glVertex3f(
x + 1.0f,
y + siz.height + 2.0f, z);
3982 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.0f, z);
3983 glVertex3f(
x + siz.width + 4.0f,
y + siz.height + 1.0f, z);
3984 glVertex3f(
x + siz.width + 4.0f,
y + 3.0f, z);
3985 glVertex3f(
x + siz.width + 3.0f,
y + 2.0f, z);
3986 glVertex3f(
x + 1.0f,
y + 2.0f, z);
3987 glVertex3f(
x,
y + 3.0f, z);
3988 glVertex3f(
x,
y + siz.height + 1.0f, z);
4009 OOGL(glEnable(GL_TEXTURE_2D));
4010 [sFontTexture
apply];
4018 NSInteger i, length;
4020 const uint8_t *bytes = NULL;
4023 length = [data length];
4024 bytes = [data bytes];
4031 for (i = 0; i < length; i++)
4033 cx += drawCharacterQuad(bytes[i], cx,
y, z, siz);
4041 OOGL(glDisable(GL_TEXTURE_2D));
4053 strsize.width += 0.5f;
4057 OOGL(glPushAttrib(GL_CURRENT_BIT));
4058 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
4060 drawHighlight(
x,
y, z, strsize, color[3]);
4062 OOGL(glPopAttrib());
4072 GLfloat govcol[] = { 0.5, 0.0, 0.7,
4083 GLfloat ce1 = 1.0f - 0.125f * eco;
4087 OOGL(glEnable(GL_TEXTURE_2D));
4088 [sFontTexture
apply];
4092 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartEconomyUColor, (unsigned long)eco]
4097 cx += drawCharacterQuad(23 - eco, cx,
y, z, siz);
4098 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartGovernmentUColor, (unsigned long)gov]
4102 cx += drawCharacterQuad(gov, cx,
y, z, siz) -
sF6KernGovt;
4103 [[UNIVERSE gui] setGLColorFromSetting:kGuiChartTechColor
4110 cx += drawCharacterQuad(49, cx,
y - 2, z, siz) -
sF6KernTL;
4112 cx += drawCharacterQuad(48 + (tl % 10), cx,
y - 2.0f, z, siz);
4119 OOGL(glDisable(GL_TEXTURE_2D));
4133 hisize.height = siz.height;
4134 hisize.width = 0.0f;
4139 if (tl > 9) hisize.width += siz.width *
sGlyphWidths[49] - 2.0;
4140 hisize.width += siz.width *
sGlyphWidths[48 + (tl % 10)];
4144 OOGL(glPushAttrib(GL_CURRENT_BIT));
4145 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
4147 drawHighlight(
x,
y - 2.0f, z, hisize, color[3]);
4149 OOGL(glPopAttrib());
4158 Vector spacepos, scannerpos;
4160 GLfloat z_factor = siz.height / siz.width;
4161 GLfloat y_factor = 1.0 - sqrt(z_factor);
4165 if (radius*radius > centre.y*centre.y)
4167 GLfloat r0 = sqrt(radius*radius-centre.y*centre.y);
4168 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
4170 for (i = 0; i < 24; i++)
4172 theta = i*2*
M_PI/24;
4173 spacepos.x = centre.x + r0 * cos(theta);
4174 spacepos.z = centre.z + r0 * sin(theta);
4176 points[i].
x =
x + scannerpos.x;
4177 points[i].
y =
y + scannerpos.z * z_factor + scannerpos.y * y_factor;
4180 spacepos.x = centre.x + r0;
4182 spacepos.z = centre.z;
4184 points[24].
x =
x + scannerpos.x;
4185 points[24].
y =
y + scannerpos.z * z_factor + scannerpos.y * y_factor;
4189 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
4195 spacepos.x = centre.x;
4196 spacepos.y = centre.y + radius;
4197 spacepos.z = centre.z;
4199 for (i = 0; i <= 24; i++)
4201 points[2*i+1].
x =
x + scannerpos.x;
4202 points[2*i+1].
y =
y + scannerpos.y * y_factor + scannerpos.z * z_factor;
4203 points[2*i+1].
z = z;
4205 for (i = 1; i <= 24; i++)
4208 for (j = 0; j <= 24; j++)
4212 points[2*j] = points[2*j+1];
4214 spacepos.
x = centre.x + radius * sin(theta) * cos(phi);
4215 spacepos.y = centre.y + radius * cos(theta);
4216 spacepos.z = centre.z + radius * sin(theta) * sin(phi);
4218 points[2*j+1].
x =
x + scannerpos.x;
4219 points[2*j+1].
y =
y + scannerpos.y * y_factor + scannerpos.z * z_factor;
4220 points[2*j+1].
z = z;
4235 GLfloat c = 1 / ( zoom - 1 );
4236 GLfloat b = c * ( c + 1 );
4238 return scale * ( a - b / (
x + c ) );
4242static void drawScannerGrid(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz,
int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
4249 GLfloat ww = 0.5 * siz.width;
4250 GLfloat hh = 0.5 * siz.height;
4255 BOOL drawdiv = NO, drawdiv1 = NO, drawdiv5 = NO;
4266 glVertex3f(
x,
y - hh, z); glVertex3f(
x,
y + hh, z);
4267 glVertex3f(
x - ww,
y, z); glVertex3f(
x + ww,
y, z);
4291 else if (i % 5 == 0)
4307 glVertex3f(
x - w1,
y + h1, z); glVertex3f(
x + w1,
y + h1, z);
4308 glVertex3f(
x - w1,
y - h1, z); glVertex3f(
x + w1,
y - h1, z);
4315 hdiv = 0.5 * siz.height / km_scan;
4316 wdiv = 0.25 * siz.width / km_scan;
4327 for (i = ii; 2.0 * hdiv * i < siz.height; i += ii)
4337 glVertex3f(
x - w1,
y + h1, z); glVertex3f(
x + w1,
y + h1, z);
4338 glVertex3f(
x - w1,
y - h1, z); glVertex3f(
x + w1,
y - h1, z);
4344 double tanfov = [gameView
fov:YES];
4346 if (aspect < 4.0/3.0)
4348 tanfov *= 0.75 * aspect;
4350 double cosfov = 1.0/sqrt(1+tanfov*tanfov);
4351 double sinfov = tanfov * cosfov;
4355 case VIEW_BREAK_PATTERN:
4356 case VIEW_GUI_DISPLAY:
4359 glVertex3f(
x,
y, z); glVertex3f(
x - ww * sinfov,
y + hh * cosfov, z);
4360 glVertex3f(
x,
y, z); glVertex3f(
x + ww * sinfov,
y + hh * cosfov, z);
4364 glVertex3f(
x,
y, z); glVertex3f(
x - ww * sinfov,
y - hh * cosfov, z);
4365 glVertex3f(
x,
y, z); glVertex3f(
x + ww * sinfov,
y - hh * cosfov, z);
4369 glVertex3f(
x,
y, z); glVertex3f(
x - ww * cosfov,
y + hh * sinfov, z);
4370 glVertex3f(
x,
y, z); glVertex3f(
x - ww * cosfov,
y - hh * sinfov, z);
4373 case VIEW_STARBOARD:
4374 glVertex3f(
x,
y, z); glVertex3f(
x + ww * cosfov,
y + hh * sinfov, z);
4375 glVertex3f(
x,
y, z); glVertex3f(
x + ww * cosfov,
y - hh * sinfov, z);
4384static void DrawSpecialOval(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat step, GLfloat *color4v)
4386 GLfloat ww = 0.5 * siz.width;
4387 GLfloat hh = 0.5 * siz.height;
4392 delta = step *
M_PI / 180.0f;
4395 for (theta = 0.0f; theta < (2.0f *
M_PI); theta += delta)
4398 glColor4f(color4v[0], color4v[1], color4v[2], fabs(s * color4v[3]));
4399 glVertex3f(
x + ww * s,
y + hh * cos(theta), z);
4405- (void) setLineWidth:(GLfloat) value
4411- (GLfloat) lineWidth
4419@implementation NSString (OODisplayEncoding)
4421- (const
char *) cStringUsingOoliteEncoding
4426 return [[
self dataUsingEncoding:[sEncodingCoverter
encoding] allowLossyConversion:YES] bytes];
4430- (const
char *) cStringUsingOoliteEncodingAndRemapping
4441@implementation OOPolygonSprite (OOHUDBeaconIcon)
4443- (void) oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4445 GLfloat
x = where.x -
size.width;
4446 GLfloat
y = where.y - 1.5 *
size.height;
4448 GLfloat ox =
x -
size.width * 0.5;
4449 GLfloat oy =
y -
size.height * 0.5;
4450 GLfloat width =
size.width * (1.0f / 6.0f);
4451 GLfloat height =
size.height * (1.0f / 6.0f);
4457 glColor4f(0.0, 0.0, 0.0, 0.5 * alpha);
4465@implementation NSString (OOHUDBeaconIcon)
4467- (void) oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4475static void SetGLColourFromInfo(NSDictionary *info, NSString *key,
const GLfloat defaultColor[4], GLfloat alpha)
4479 colorDesc = [info objectForKey:key];
4480 if (colorDesc !=
nil)
4487 GLColorWithOverallAlpha(ioColor,alpha);
4491 GLColorWithOverallAlpha(defaultColor,alpha);
4501 colorDesc = [info objectForKey:RGB_COLOR_KEY];
4502 if (colorDesc !=
nil && ![info objectForKey:
ALPHA_KEY])
4513 colorDesc = [info oo_arrayForKey:RGB_COLOR_KEY];
4514 if (colorDesc !=
nil && [colorDesc
count] == 3)
4516 ioColor[0] = [colorDesc oo_nonNegativeFloatAtIndex:0];
4517 ioColor[1] = [colorDesc oo_nonNegativeFloatAtIndex:1];
4518 ioColor[2] = [colorDesc oo_nonNegativeFloatAtIndex:2];
4520 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
#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
@ OO_RETICLE_COLOR_TARGET
@ OO_RETICLE_COLOR_WORMHOLE
#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 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
#define OOLogERR(class, format,...)
NSString *const kOOLogFileNotFound
Vector OOVectorMultiplyMatrix(Vector v, OOMatrix m)
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)
Vector vector_up_from_quaternion(Quaternion quat)
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2)
#define OOExpandKey(key,...)
@ OO_SYSTEMCONCEALMENT_NONAME
@ kOOTextureMinFilterMipMap
@ kOOTextureMagFilterLinear
const Vector kBasisYVector
const Vector kBasisZVector
const Vector kBasisXVector
Vector OOVectorRandomRadial(OOScalar maxLength)
@ SCOOP_STATUS_NOT_INSTALLED
@ MISSILE_STATUS_TARGET_LOCKED
#define PLAYER_TARGET_MEMORY_SIZE
NSString * OOStringFromWeaponType(OOWeaponType weapon) CONST_FUNC
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
BOOL checkPlayerInFlight()
BOOL checkPlayerInSystemFlight()
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)
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)
void OODrawStringQuadsAligned(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz, BOOL rightAlign)
static GLfloat nonlinearScannerFunc(GLfloat distance, GLfloat zoom, GLfloat scale)
static void hudDrawBarAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount)
static void hudDrawSurroundAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz)
NSRect OORectFromString(NSString *text, GLfloat x, GLfloat y, NSSize siz)
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 OOStartDrawingStrings()
static void GLDrawNonlinearCascadeWeapon(GLfloat x, GLfloat y, GLfloat z, NSSize siz, Vector centre, GLfloat radius, GLfloat zoom, GLfloat alpha)
void OODrawHilightedString(NSString *text, GLfloat x, GLfloat y, GLfloat z, NSSize siz)
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)
CGFloat OOStringWidthInEm(NSString *text)
static void hudDrawReticleOnTarget(Entity *target, PlayerEntity *player1, GLfloat z1, GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive, BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
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)
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()
OOColor * scannerDisplayColor1()
NSMutableArray * targetMemory()
Vector customViewUpVector
Vector customViewForwardVector
double clockTimeAdjusted()
NSDictionary * whitelistDictionary()
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)
OOColor * scannerDisplayColor2()
BoundingBox totalBoundingBox
NSString * scanDescription()
OOColor * scannerDisplayColorHostile2()
OOColor * scannerDisplayColorHostile1()
void setMessageTime:(double value)
OOColor * scannerDisplayColor1()
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque