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];
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;
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;
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];
2774 Entity *compass = [PLAYER compassTarget];
2776 foreach (waypoint, [[
UNIVERSE currentWaypoints] allValues])
2784- (void) drawStatusLight:(NSDictionary *)info
2788 GLfloat alpha = overallAlpha;
2789 BOOL blueAlert = cloakIndicatorOnStatusLight && [PLAYER isCloaked];
2792 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2798 alpha *= cached.
alpha;
2800 GLfloat status_color[4] = { 0.25, 0.25, 0.25, 1.0};
2801 int alertCondition = [PLAYER alertCondition];
2802 GLfloat flash_alpha = 0.333 * (2.0f + sin((GLfloat)[
UNIVERSE getTime] * 2.5f * alertCondition));
2804 switch(alertCondition)
2828 status_color[3] = flash_alpha;
2829 GLColorWithOverallAlpha(status_color, alpha);
2833 OOGL(glColor4f(0.25, 0.25, 0.25, alpha));
2840- (void) drawDirectionCue:(NSDictionary *)info
2842 GLfloat alpha = overallAlpha;
2845 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2847 alpha *= cached.
alpha;
2851 Entity *target = [PLAYER primaryTarget];
2852 if (target ==
nil)
return;
2857 rotMatrix = [PLAYER rotationMatrix];
2859 if ([
UNIVERSE viewDirection] != VIEW_GUI_DISPLAY)
2864 const float visMin = 0.994521895368273f;
2865 const float visMax = 0.984807753012208f;
2868 Vector rpn = [PLAYER vectorTo:target];
2870 Vector drawPos = rpn;
2879 drawPos.x = - drawPos.
x;
2883 drawPos.x = drawPos.z;
2886 case VIEW_STARBOARD:
2887 drawPos.x = -drawPos.z;
2897 float cosAngle = dot_product(vector_normal(rpn), forward);
2898 float visibility = 1.0f - ((visMax - cosAngle) * (1.0f / (visMax - visMin)));
2899 alpha *= OOClamp_0_1_f(visibility);
2904 OOColor *directionCueColor = [_reticleColors objectAtIndex:cueColorIndex];
2905 GLfloat clearColorArray[4] = {[directionCueColor
redComponent],
2909 GLfloat directionCueColorArray[4] = {[directionCueColor
redComponent],
2914 drawPos = vector_normal(drawPos);
2916 glColor4fv(clearColorArray);
2917 glVertex3f(drawPos.x * innerSize - drawPos.y * width, drawPos.y * innerSize + drawPos.x * width, z1);
2918 GLColorWithOverallAlpha(directionCueColorArray, alpha);
2919 glVertex3f(drawPos.x * outerSize, drawPos.y * outerSize, z1);
2920 glColor4fv(clearColorArray);
2921 glVertex3f(drawPos.x * innerSize + drawPos.y * width, drawPos.y * innerSize - drawPos.x * width, z1);
2928- (void) drawClock:(NSDictionary *)info
2932 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2935 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2943 itemColor[3] *= overallAlpha;
2945 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2950- (void) drawPrimedEquipment:(NSDictionary *)info
2952 if ([
PLAYER status] == STATUS_DOCKED)
2958 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
2961 NSUInteger lines = [info oo_intForKey:@"n_bars" defaultValue:1];
2962 NSInteger pec = (NSInteger)[
PLAYER primedEquipmentCount];
2964 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
2982 itemColor[3] *= overallAlpha;
2986 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
2987 NSString *equipmentName = [PLAYER primedEquipmentName:0];
2992 NSInteger negative = (lines - 1) / 2;
2993 NSInteger positive = lines / 2;
2994 for (NSInteger i = -negative; i <= positive; i++)
2996 if (i >= -(pec) / 2 && i <= (pec + 1) / 2)
3000 GLfloat alphaScale = 1.0/((i<0)?(1.0-i):(1.0+i));
3001 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]*alphaScale));
3010- (void) drawASCTarget:(NSDictionary *)info
3012 if (!([
self checkPlayerInSystemFlight] && [
PLAYER status] != STATUS_LAUNCHING))
3018 GLfloat itemColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
3021 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3033 itemColor[3] *= overallAlpha;
3035 OOGL(glColor4f(itemColor[0], itemColor[1], itemColor[2], itemColor[3]));
3036 if ([info oo_intForKey:
@"align"] == 1)
3048- (void) drawWeaponsOfflineText:(NSDictionary *)info
3050 OOViewID viewID = [UNIVERSE viewDirection];
3051 GLfloat textColor[4] = {0.0f, 1.0f, 0.0f, 1.0f};
3053 if (viewID == VIEW_CUSTOM ||
3054 overallAlpha == 0.0f ||
3055 !([
PLAYER status] == STATUS_IN_FLIGHT || [
PLAYER status] == STATUS_WITCHSPACE_COUNTDOWN) ||
3063 if (![
PLAYER weaponsOnline])
3069 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3077 textColor[3] *= overallAlpha;
3079 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], textColor[3]));
3086- (void) drawFPSInfoCounter:(NSDictionary *)info
3088 if (![
UNIVERSE displayFPS])
return;
3093 GLfloat textColor[4] = {0.0, 1.0, 0.0, 1.0};
3095 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3102 HPVector playerPos = [PLAYER position];
3103 NSString *positionInfo = [UNIVERSE expressPosition:playerPos inCoordinateSystem:@"pwm"];
3104 positionInfo = [NSString stringWithFormat:@"abs %.2f %.2f %.2f / %@", playerPos.x, playerPos.y, playerPos.z, positionInfo];
3109 OOGL(glColor4f(textColor[0], textColor[1], textColor[2], 1.0f));
3113 NSSize siz08 = NSMakeSize(0.8 * siz.width, 0.8 * siz.width);
3114 NSString *collDebugInfo = [NSString stringWithFormat:@"%@ - %@", [PLAYER dial_objinfo], [UNIVERSE collisionDescription]];
3119 NSString *timeAccelerationFactorInfo = [NSString stringWithFormat:@"TAF: %@%.2f", DESC(@"multiplication-sign"), [UNIVERSE timeAccelerationFactor]];
3120 OODrawString(timeAccelerationFactorInfo,
x,
y - 3.2 * siz08.height, z1, siz08);
3125- (void) drawScoopStatus:(NSDictionary *)info
3132 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3139 alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:0.75f];
3142 GLfloat s1c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3143 GLfloat s2c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3144 GLfloat s3c[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
3145 int scoop_status = [PLAYER dialFuelScoopStatus];
3146 GLfloat t = [UNIVERSE getTime];
3147 GLfloat a1 = alpha * 0.5f * (1.0f + sin(t * 8.0f));
3148 GLfloat a2 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 1.0f));
3149 GLfloat a3 = alpha * 0.5f * (1.0f + sin(t * 8.0f - 2.0f));
3151 switch (scoop_status)
3167 for (i = 0; i < 3; i++)
3169 s1c[i] = s0_color[i];
3170 s2c[i] = s0_color[i];
3171 s3c[i] = s0_color[i];
3181 s1c[3] = alpha * a1;
3182 s2c[3] = alpha * a2;
3183 s3c[3] = alpha * a3;
3192 GLfloat w1 = siz.width / 8.0;
3193 GLfloat w2 = 2.0 * w1;
3195 GLfloat w4 = 4.0 * w1;
3196 GLfloat h1 = siz.height / 8.0;
3197 GLfloat h2 = 2.0 * h1;
3198 GLfloat h3 = 3.0 * h1;
3199 GLfloat h4 = 4.0 * h1;
3201 OOGL(glDisable(GL_TEXTURE_2D));
3204 GLColorWithOverallAlpha(s1c, overallAlpha);
3205 glVertex3f(
x,
y + h1, z1); glVertex3f(
x - w2,
y + h2, z1); glVertex3f(
x,
y + h3, z1); glVertex3f(
x + w2,
y + h2, z1);
3207 GLColorWithOverallAlpha(s2c, overallAlpha);
3208 glVertex3f(
x,
y - h1, z1); glVertex3f(
x - w4,
y + h1, z1); glVertex3f(
x - w4,
y + h2, z1); glVertex3f(
x,
y, z1);
3209 glVertex3f(
x,
y - h1, z1); glVertex3f(
x + w4,
y + h1, z1); glVertex3f(
x + w4,
y + h2, z1); glVertex3f(
x,
y, z1);
3211 GLColorWithOverallAlpha(s3c, overallAlpha);
3212 glVertex3f(
x,
y - h4, z1); glVertex3f(
x - w2,
y - h2, z1); glVertex3f(
x - w2,
y - h1, z1); glVertex3f(
x,
y - h2, z1);
3213 glVertex3f(
x,
y - h4, z1); glVertex3f(
x + w2,
y - h2, z1); glVertex3f(
x + w2,
y - h1, z1); glVertex3f(
x,
y - h2, z1);
3218- (void) drawStickSensitivityIndicator:(NSDictionary *)info
3222 GLfloat alpha = overallAlpha;
3223 BOOL mouse = [PLAYER isMouseControlOn];
3227 if (![stickHandler joystickCount])
3232 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3238 alpha *= cached.
alpha;
3252 NSSize siz8th = { siz.width / 8, siz.height / 8 };
3259 siz.width -= _crosshairWidth * lineWidth / 2;
3260 siz.height -= _crosshairWidth * lineWidth / 2;
3270- (void) drawSurroundInternal:(NSDictionary *)info color:(const GLfloat[4])color
3274 GLfloat alpha = overallAlpha;
3277 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3284 x = cached.
x + [[
UNIVERSE gameView] x_offset] * cached.x0;
3285 y = cached.
y + [[
UNIVERSE gameView] y_offset] * cached.y0;
3288 alpha *= cached.
alpha;
3291 GLColorWithOverallAlpha(color, alpha);
3296- (void) drawSurround:(NSDictionary *)info
3298 GLfloat itemColor[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
3299 id colorDesc = [info objectForKey:COLOR_KEY];
3300 if (colorDesc !=
nil)
3311 [
self drawSurroundInternal:info color:itemColor];
3315- (void) drawGreenSurround:(NSDictionary *)info
3317 [
self drawSurroundInternal:info color:green_color];
3321- (void) drawYellowSurround:(NSDictionary *)info
3323 [
self drawSurroundInternal:info color:yellow_color];
3327- (void) drawTrumbles:(NSDictionary *)info
3329 OOTrumble** trumbles = [PLAYER trumbleArray];
3331 for (i = [
PLAYER trumbleCount]; i > 0; i--)
3339- (void) drawMultiFunctionDisplay:(NSDictionary *)info withText:(NSString *)text asIndex:(NSUInteger)index
3345 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3349 GLfloat alpha = [info oo_nonNegativeFloatForKey:ALPHA_KEY defaultValue:1.0f] * overallAlpha;
3351 GLfloat mfd_color[4] = {0.0, 1.0, 0.0, 0.9*alpha};
3357 if (index != [player1 activeMFD])
3359 mfd_color[3] *= 0.75;
3361 [
self drawSurroundInternal:info color:mfd_color];
3363 [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached];
3364 x = cached.
x + [[
UNIVERSE gameView] x_offset] * cached.x0;
3365 y = cached.
y + [[
UNIVERSE gameView] y_offset] * cached.y0;
3370 GLfloat x0 = (GLfloat)(
x - cached.
width/2);
3371 GLfloat y0 = (GLfloat)(
y + cached.
height/2);
3372 GLfloat x1 = (GLfloat)(
x + cached.
width/2);
3373 GLfloat y1 = (GLfloat)(
y - cached.
height/2);
3374 GLColorWithOverallAlpha(mfd_color, alpha*0.3);
3376 glVertex3f(x0-2,y0+2,z1);
3377 glVertex3f(x0-2,y1-2,z1);
3378 glVertex3f(x1+2,y1-2,z1);
3379 glVertex3f(x1+2,y0+2,z1);
3382 NSString *line =
nil;
3383 NSArray *lines = [text componentsSeparatedByString:@"\n"];
3385 GLColorWithOverallAlpha(mfd_color, alpha);
3386 for (i = 0; i < 10 ; i++)
3388 line = [lines oo_stringAtIndex:i defaultValue:nil];
3394 if (textwidth <= cached.
width)
3401 tmpsiz.height = siz.height;
3402 tmpsiz.width = siz.width * cached.
width / textwidth;
3417 if (siz.width > siz.height)
3419 GLfloat dial_oy =
y - siz.height/2;
3420 GLfloat position =
x + amount * siz.width / 2;
3422 glVertex3f(position, dial_oy, z);
3423 glVertex3f(position+2,
y, z);
3424 glVertex3f(position, dial_oy+siz.height, z);
3425 glVertex3f(position-2,
y, z);
3430 GLfloat dial_ox =
x - siz.width/2;
3431 GLfloat position =
y + amount * siz.height / 2;
3433 glVertex3f(dial_ox, position, z);
3434 glVertex3f(
x, position+2, z);
3435 glVertex3f(dial_ox + siz.width, position, z);
3436 glVertex3f(
x, position-2, z);
3444 if (siz.width > siz.height)
3446 GLfloat dial_oy =
y - siz.height/2;
3447 GLfloat position =
x + amount * siz.width - siz.width/2;
3449 glVertex3f(position+1, dial_oy+1, z);
3450 glVertex3f(position+1, dial_oy+siz.height-1, z);
3451 glVertex3f(position-1, dial_oy+siz.height-1, z);
3452 glVertex3f(position-1, dial_oy+1, z);
3457 GLfloat dial_ox =
x - siz.width/2;
3458 GLfloat position =
y + amount * siz.height - siz.height/2;
3460 glVertex3f(dial_ox+1, position+1, z);
3461 glVertex3f(dial_ox + siz.width-1, position+1, z);
3462 glVertex3f(dial_ox + siz.width-1, position-1, z);
3463 glVertex3f(dial_ox+1, position-1, z);
3471 GLfloat dial_ox =
x - siz.width/2;
3472 GLfloat dial_oy =
y - siz.height/2;
3473 if (fabs(siz.width) > fabs(siz.height))
3475 GLfloat position = dial_ox + amount * siz.width;
3478 glVertex3f(dial_ox, dial_oy, z);
3479 glVertex3f(position, dial_oy, z);
3480 glVertex3f(position, dial_oy+siz.height, z);
3481 glVertex3f(dial_ox, dial_oy+siz.height, z);
3486 GLfloat position = dial_oy + amount * siz.height;
3489 glVertex3f(dial_ox, dial_oy, z);
3490 glVertex3f(dial_ox, position, z);
3491 glVertex3f(dial_ox+siz.width, position, z);
3492 glVertex3f(dial_ox+siz.width, dial_oy, z);
3500 GLfloat dial_ox =
x - siz.width/2;
3501 GLfloat dial_oy =
y - siz.height/2;
3504 glVertex3f(dial_ox-2, dial_oy-2, z);
3505 glVertex3f(dial_ox+siz.width+2, dial_oy-2, z);
3506 glVertex3f(dial_ox+siz.width+2, dial_oy+siz.height+2, z);
3507 glVertex3f(dial_ox-2, dial_oy+siz.height+2, z);
3514 int ox =
x - siz.width / 2.0;
3515 int oy =
y - siz.height / 2.0;
3516 int w = siz.width / 4.0;
3517 int h = siz.height / 4.0;
3519 glVertex3i(ox, oy + h, z);
3520 glVertex3i(ox, oy + 3 * h, z);
3521 glVertex3i(ox + w, oy + 4 * h, z);
3522 glVertex3i(ox + 3 * w, oy + 4 * h, z);
3523 glVertex3i(ox + 4 * w, oy + 3 * h, z);
3524 glVertex3i(ox + 4 * w, oy + h, z);
3525 glVertex3i(ox + 3 * w, oy, z);
3526 glVertex3i(ox + w, oy, z);
3531 GLfloat alpha, BOOL reticleTargetSensitive, NSMutableDictionary *propertiesReticleTargetSensitive,
3532 BOOL colourFromScannerColour, BOOL showText, NSDictionary *info, NSMutableArray *reticleColors)
3534 if (target ==
nil || player1 ==
nil)
3538 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3544 NSString *legal_desc =
nil;
3546 GLfloat scale = [info oo_floatForKey:@"reticle_scale" defaultValue:ONE_SIXTYFOURTH];
3549 if ([target isShip])
3555 if ([target_ship isCloaked])
return;
3561 p1 = HPVectorToVector(HPvector_subtract([target position], [player1 viewpointPosition]));
3563 GLfloat rdist = magnitude(p1);
3564 GLfloat rsize = [target
collisionRadius] / (2 * [[UNIVERSE gameView] fov:YES]);
3566 if (rsize < rdist * scale)
3567 rsize = rdist * scale;
3569 GLfloat rs0 = rsize;
3570 GLfloat rs2 = rsize * 0.50;
3582 if ([target isWormhole])
3584 OOColor *wormholeReticleColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_WORMHOLE];
3585 GLfloat wormholeReticleColorArray[4] = {[wormholeReticleColor
redComponent],
3589 GLColorWithOverallAlpha(wormholeReticleColorArray, alpha);
3594 BOOL isTargeted = NO;
3595 GLfloat probabilityAccuracy;
3597 if (propertiesReticleTargetSensitive !=
nil)
3600 if (range < [player1 weaponRange])
3606 if ([
UNIVERSE getTime] > [propertiesReticleTargetSensitive oo_doubleForKey:
@"timeLastAccuracyProbabilityCalculation"] + 1)
3611 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithBool:((randf() < probabilityAccuracy) ? YES : NO)] forKey:@"isAccurate"];
3614 [propertiesReticleTargetSensitive setObject:[NSNumber numberWithDouble:[UNIVERSE getTime]] forKey:@"timeLastAccuracyProbabilityCalculation"];
3616 if ([propertiesReticleTargetSensitive oo_boolForKey:
@"isAccurate"])
3619 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3624 isTargeted = ([UNIVERSE firstEntityTargetedByPlayer] == target);
3630 isTargeted = ([UNIVERSE firstEntityTargetedByPlayerPrecisely] == target);
3643 if (colourFromScannerColour)
3645 if ([target isShip])
3651 else if ([target isVisualEffect])
3664 if (reticleTargetSensitive && isTargeted)
3666 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET_SENSITIVE];
3671 reticleDisplayColor = [reticleColors objectAtIndex:OO_RETICLE_COLOR_TARGET];
3674 GLfloat reticleDisplayColorArray[4] = { [reticleDisplayColor
redComponent],
3678 GLColorWithOverallAlpha(reticleDisplayColorArray, alpha);
3682 glVertex2f(rs0,rs2); glVertex2f(rs0,rs0);
3683 glVertex2f(rs0,rs0); glVertex2f(rs2,rs0);
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);
3699 if (range < 0.001f) range = 0.0f;
3700 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3701 float line_height = rdist * scale;
3702 NSString* infoline = [NSString stringWithFormat:@"%0.3f km", range];
3703 if (legal_desc !=
nil) infoline = [NSString stringWithFormat:@"%@ (%@)", infoline, legal_desc];
3705 OODrawString([player1 dialTargetName], rs0, 0.5 * rs2, 0, textsize);
3706 OODrawString(infoline, rs0, 0.5 * rs2 - line_height, 0, textsize);
3708 if ([target isWormhole])
3721 NSString *wormholeETA = [NSString stringWithFormat:DESC(@"wormhole-ETA-@"), ClockToString([(
WormholeEntity *)
target estimatedArrivalTime], NO)];
3722 OODrawString(wormholeETA, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
3727 int minutesToCollapse = floor (timeForCollapsing / 60.0);
3728 int secondsToCollapse = (
int)timeForCollapsing % 60;
3730 NSString *wormholeExpiringIn = [NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
3731 OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
3746 if ([player1 guiScreen] != GUI_SCREEN_MAIN)
3752 Vector p1 = HPVectorToVector(HPvector_subtract([waypoint position], [player1 viewpointPosition]));
3760 GLfloat rdist = magnitude(p1);
3761 GLfloat rsize = rdist * scale;
3763 GLfloat rs0 = rsize;
3764 GLfloat rs2 = rsize * 0.50;
3772 GLColorWithOverallAlpha(
blue_color, alpha*0.25);
3776 glVertex2f(rs0,rs2); glVertex2f(rs2,rs2);
3777 glVertex2f(rs2,rs0); glVertex2f(rs2,rs2);
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);
3794 GLfloat range = HPdistance([player1 position],[waypoint position]) * 0.001f;
3795 if (range < 0.001f) range = 0.0f;
3796 NSSize textsize = NSMakeSize(rdist * scale, rdist * scale);
3797 float line_height = rdist * scale;
3798 NSString* infoline = [NSString stringWithFormat:@"%0.3f km", range];
3799 OODrawString(infoline, rs0 * 0.5, -rs2 - line_height, 0, textsize);
3808 back_q.w = -back_q.w;
3810 NSSize viewSize = [[UNIVERSE gameView] viewSize];
3811 float aspect = viewSize.width / viewSize.height;
3816 float ratio = 2 * [[UNIVERSE gameView] fov:YES];
3817 if (3.0f * aspect >= 4.0f)
3823 OOGLScaleModelView(make_vector((4.0f/3.0f)/(aspect*ratio), (4.0f/3.0f)/(aspect*ratio), 1.0f));
3832 view_dir.x = 0.0; view_dir.y = 0.0; view_dir.z = 1.0;
3836 view_dir.x = 0.0; view_dir.y = 0.0; view_dir.z = -1.0;
3841 view_dir.x = -1.0; view_dir.y = 0.0; view_dir.z = 0.0;
3845 case VIEW_STARBOARD:
3846 view_dir.x = 1.0; view_dir.y = 0.0; view_dir.z = 0.0;
3871static void InitTextEngine(
void)
3873 NSDictionary *fontSpec =
nil;
3874 NSArray *widths =
nil;
3875 NSString *texName =
nil;
3876 NSUInteger i,
count;
3882 texName = [fontSpec oo_stringForKey:@"texture" defaultValue:@"oolite-font.png"];
3890 sF6KernGovt = [fontSpec oo_floatForKey:@"f6KernGovernment" defaultValue:1.0];
3891 sF6KernTL = [fontSpec oo_floatForKey:@"f6KernTechLevel" defaultValue:2.0];
3894 widths = [fontSpec oo_arrayForKey:@"widths"];
3895 count = [widths count];
3897 for (i = 0; i !=
count; ++i)
3911static GLfloat drawCharacterQuad(uint8_t chr, GLfloat
x, GLfloat
y, GLfloat z, NSSize siz)
3915 if (chr > 32 || chr < 31) {
3921 glVertex3f(
x,
y, z);
3923 glVertex3f(
x + siz.width,
y, z);
3925 glVertex3f(
x + siz.width,
y + siz.height, z);
3926 glTexCoord2f(texture_x, texture_y);
3927 glVertex3f(
x,
y + siz.height, z);
3937 const uint8_t *bytes = NULL;
3938 NSUInteger i, length;
3941 bytes = [data bytes];
3942 length = [data length];
3944 for (i = 0; i < length; i++)
3949 return NSMakeRect(
x,
y, w, siz.height);
3962 OOGL(glColor4f(0.0f, 0.0f, 0.0f, alpha * 0.4f));
3966 glVertex3f(
x + 1.0f ,
y + siz.height + 2.5f, z);
3967 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.5f, z);
3968 glVertex3f(
x + siz.width + 4.5f,
y + siz.height + 1.0f, z);
3969 glVertex3f(
x + siz.width + 4.5f,
y + 3.0f, z);
3970 glVertex3f(
x + siz.width + 3.0f,
y + 1.5f, z);
3971 glVertex3f(
x + 1.0f,
y + 1.5f, z);
3972 glVertex3f(
x - 0.5f,
y + 3.0f, z);
3973 glVertex3f(
x - 0.5f,
y + siz.height + 1.0f, z);
3978 glVertex3f(
x + 1.0f,
y + siz.height + 2.0f, z);
3979 glVertex3f(
x + siz.width + 3.0f,
y + siz.height + 2.0f, z);
3980 glVertex3f(
x + siz.width + 4.0f,
y + siz.height + 1.0f, z);
3981 glVertex3f(
x + siz.width + 4.0f,
y + 3.0f, z);
3982 glVertex3f(
x + siz.width + 3.0f,
y + 2.0f, z);
3983 glVertex3f(
x + 1.0f,
y + 2.0f, z);
3984 glVertex3f(
x,
y + 3.0f, z);
3985 glVertex3f(
x,
y + siz.height + 1.0f, z);
4006 OOGL(glEnable(GL_TEXTURE_2D));
4007 [sFontTexture
apply];
4015 NSInteger i, length;
4017 const uint8_t *bytes = NULL;
4020 length = [data length];
4021 bytes = [data bytes];
4028 for (i = 0; i < length; i++)
4030 cx += drawCharacterQuad(bytes[i], cx,
y, z, siz);
4038 OOGL(glDisable(GL_TEXTURE_2D));
4050 strsize.width += 0.5f;
4054 OOGL(glPushAttrib(GL_CURRENT_BIT));
4055 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
4057 drawHighlight(
x,
y, z, strsize, color[3]);
4059 OOGL(glPopAttrib());
4069 GLfloat govcol[] = { 0.5, 0.0, 0.7,
4080 GLfloat ce1 = 1.0f - 0.125f * eco;
4084 OOGL(glEnable(GL_TEXTURE_2D));
4085 [sFontTexture
apply];
4089 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartEconomyUColor, (unsigned long)eco]
4094 cx += drawCharacterQuad(23 - eco, cx,
y, z, siz);
4095 [[UNIVERSE gui] setGLColorFromSetting:[NSString stringWithFormat:kGuiChartGovernmentUColor, (unsigned long)gov]
4099 cx += drawCharacterQuad(gov, cx,
y, z, siz) -
sF6KernGovt;
4100 [[UNIVERSE gui] setGLColorFromSetting:kGuiChartTechColor
4107 cx += drawCharacterQuad(49, cx,
y - 2, z, siz) -
sF6KernTL;
4109 cx += drawCharacterQuad(48 + (tl % 10), cx,
y - 2.0f, z, siz);
4116 OOGL(glDisable(GL_TEXTURE_2D));
4130 hisize.height = siz.height;
4131 hisize.width = 0.0f;
4136 if (tl > 9) hisize.width += siz.width *
sGlyphWidths[49] - 2.0;
4137 hisize.width += siz.width *
sGlyphWidths[48 + (tl % 10)];
4141 OOGL(glPushAttrib(GL_CURRENT_BIT));
4142 OOGL(glGetFloatv(GL_CURRENT_COLOR, color));
4144 drawHighlight(
x,
y - 2.0f, z, hisize, color[3]);
4146 OOGL(glPopAttrib());
4155 Vector spacepos, scannerpos;
4157 GLfloat z_factor = siz.height / siz.width;
4158 GLfloat y_factor = 1.0 - sqrt(z_factor);
4162 if (radius*radius > centre.y*centre.y)
4164 GLfloat r0 = sqrt(radius*radius-centre.y*centre.y);
4165 OOGL(glColor4f(1.0, 0.5, 1.0, alpha));
4167 for (i = 0; i < 24; i++)
4169 theta = i*2*
M_PI/24;
4170 spacepos.x = centre.x + r0 * cos(theta);
4171 spacepos.z = centre.z + r0 * sin(theta);
4173 points[i].
x =
x + scannerpos.x;
4174 points[i].
y =
y + scannerpos.z * z_factor + scannerpos.y * y_factor;
4177 spacepos.x = centre.x + r0;
4179 spacepos.z = centre.z;
4181 points[24].
x =
x + scannerpos.x;
4182 points[24].
y =
y + scannerpos.z * z_factor + scannerpos.y * y_factor;
4186 OOGL(glColor4f(0.5, 0.0, 1.0, 0.33333 * alpha));
4192 spacepos.x = centre.x;
4193 spacepos.y = centre.y + radius;
4194 spacepos.z = centre.z;
4196 for (i = 0; i <= 24; i++)
4198 points[2*i+1].
x =
x + scannerpos.x;
4199 points[2*i+1].
y =
y + scannerpos.y * y_factor + scannerpos.z * z_factor;
4200 points[2*i+1].
z = z;
4202 for (i = 1; i <= 24; i++)
4205 for (j = 0; j <= 24; j++)
4209 points[2*j] = points[2*j+1];
4211 spacepos.
x = centre.x + radius * sin(theta) * cos(phi);
4212 spacepos.y = centre.y + radius * cos(theta);
4213 spacepos.z = centre.z + radius * sin(theta) * sin(phi);
4215 points[2*j+1].
x =
x + scannerpos.x;
4216 points[2*j+1].
y =
y + scannerpos.y * y_factor + scannerpos.z * z_factor;
4217 points[2*j+1].
z = z;
4232 GLfloat c = 1 / ( zoom - 1 );
4233 GLfloat b = c * ( c + 1 );
4235 return scale * ( a - b / (
x + c ) );
4239static void drawScannerGrid(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz,
int v_dir, GLfloat thickness, GLfloat zoom, BOOL nonlinear, BOOL minimalistic)
4246 GLfloat ww = 0.5 * siz.width;
4247 GLfloat hh = 0.5 * siz.height;
4252 BOOL drawdiv = NO, drawdiv1 = NO, drawdiv5 = NO;
4263 glVertex3f(
x,
y - hh, z); glVertex3f(
x,
y + hh, z);
4264 glVertex3f(
x - ww,
y, z); glVertex3f(
x + ww,
y, z);
4288 else if (i % 5 == 0)
4304 glVertex3f(
x - w1,
y + h1, z); glVertex3f(
x + w1,
y + h1, z);
4305 glVertex3f(
x - w1,
y - h1, z); glVertex3f(
x + w1,
y - h1, z);
4312 hdiv = 0.5 * siz.height / km_scan;
4313 wdiv = 0.25 * siz.width / km_scan;
4324 for (i = ii; 2.0 * hdiv * i < siz.height; i += ii)
4334 glVertex3f(
x - w1,
y + h1, z); glVertex3f(
x + w1,
y + h1, z);
4335 glVertex3f(
x - w1,
y - h1, z); glVertex3f(
x + w1,
y - h1, z);
4341 double tanfov = [gameView
fov:YES];
4343 if (aspect < 4.0/3.0)
4345 tanfov *= 0.75 * aspect;
4347 double cosfov = 1.0/sqrt(1+tanfov*tanfov);
4348 double sinfov = tanfov * cosfov;
4352 case VIEW_BREAK_PATTERN:
4353 case VIEW_GUI_DISPLAY:
4356 glVertex3f(
x,
y, z); glVertex3f(
x - ww * sinfov,
y + hh * cosfov, z);
4357 glVertex3f(
x,
y, z); glVertex3f(
x + ww * sinfov,
y + hh * cosfov, z);
4361 glVertex3f(
x,
y, z); glVertex3f(
x - ww * sinfov,
y - hh * cosfov, z);
4362 glVertex3f(
x,
y, z); glVertex3f(
x + ww * sinfov,
y - hh * cosfov, z);
4366 glVertex3f(
x,
y, z); glVertex3f(
x - ww * cosfov,
y + hh * sinfov, z);
4367 glVertex3f(
x,
y, z); glVertex3f(
x - ww * cosfov,
y - hh * sinfov, z);
4370 case VIEW_STARBOARD:
4371 glVertex3f(
x,
y, z); glVertex3f(
x + ww * cosfov,
y + hh * sinfov, z);
4372 glVertex3f(
x,
y, z); glVertex3f(
x + ww * cosfov,
y - hh * sinfov, z);
4381static void DrawSpecialOval(GLfloat
x, GLfloat
y, GLfloat z, NSSize siz, GLfloat step, GLfloat *color4v)
4383 GLfloat ww = 0.5 * siz.width;
4384 GLfloat hh = 0.5 * siz.height;
4389 delta = step *
M_PI / 180.0f;
4392 for (theta = 0.0f; theta < (2.0f *
M_PI); theta += delta)
4395 glColor4f(color4v[0], color4v[1], color4v[2], fabs(s * color4v[3]));
4396 glVertex3f(
x + ww * s,
y + hh * cos(theta), z);
4402- (void) setLineWidth:(GLfloat) value
4408- (GLfloat) lineWidth
4416@implementation NSString (OODisplayEncoding)
4418- (const
char *) cStringUsingOoliteEncoding
4423 return [[
self dataUsingEncoding:[sEncodingCoverter
encoding] allowLossyConversion:YES] bytes];
4427- (const
char *) cStringUsingOoliteEncodingAndRemapping
4438@implementation OOPolygonSprite (OOHUDBeaconIcon)
4440- (void) oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4442 GLfloat
x = where.x -
size.width;
4443 GLfloat
y = where.y - 1.5 *
size.height;
4445 GLfloat ox =
x -
size.width * 0.5;
4446 GLfloat oy =
y -
size.height * 0.5;
4447 GLfloat width =
size.width * (1.0f / 6.0f);
4448 GLfloat height =
size.height * (1.0f / 6.0f);
4454 glColor4f(0.0, 0.0, 0.0, 0.5 * alpha);
4462@implementation NSString (OOHUDBeaconIcon)
4464- (void) oo_drawHUDBeaconIconAt:(NSPoint)where size:(NSSize)size alpha:(GLfloat)alpha z:(GLfloat)z
4472static void SetGLColourFromInfo(NSDictionary *info, NSString *key,
const GLfloat defaultColor[4], GLfloat alpha)
4476 colorDesc = [info objectForKey:key];
4477 if (colorDesc !=
nil)
4484 GLColorWithOverallAlpha(ioColor,alpha);
4488 GLColorWithOverallAlpha(defaultColor,alpha);
4498 colorDesc = [info objectForKey:RGB_COLOR_KEY];
4499 if (colorDesc !=
nil && ![info objectForKey:
ALPHA_KEY])
4510 colorDesc = [info oo_arrayForKey:RGB_COLOR_KEY];
4511 if (colorDesc !=
nil && [colorDesc
count] == 3)
4513 ioColor[0] = [colorDesc oo_nonNegativeFloatAtIndex:0];
4514 ioColor[1] = [colorDesc oo_nonNegativeFloatAtIndex:1];
4515 ioColor[2] = [colorDesc oo_nonNegativeFloatAtIndex:2];
4517 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