diff --git a/src/Cocoa/MyOpenGLView.m b/src/Cocoa/MyOpenGLView.m index 9102fd2d8..0680c7f60 100644 --- a/src/Cocoa/MyOpenGLView.m +++ b/src/Cocoa/MyOpenGLView.m @@ -87,8 +87,6 @@ - (id) initWithFrame:(NSRect)frameRect } #endif - matrixManager = [[OOOpenGLMatrixManager alloc] init]; - // Pixel Format Attributes for the View-based (non-FullScreen) NSOpenGLContext NSOpenGLPixelFormatAttribute attrs[] = { @@ -137,6 +135,7 @@ - (id) initWithFrame:(NSRect)frameRect [self setWantsBestResolutionOpenGLSurface:YES]; } + matrixManager = [[OOOpenGLMatrixManager alloc] init]; _pixelFormatAttributes = [[NSData alloc] initWithBytes:attrs length:sizeof attrs]; virtualJoystickPosition = NSMakePoint(0.0,0.0); diff --git a/src/Core/Entities/OOPlanetEntity.h b/src/Core/Entities/OOPlanetEntity.h index 4c1160ba4..139b6bb07 100644 --- a/src/Core/Entities/OOPlanetEntity.h +++ b/src/Core/Entities/OOPlanetEntity.h @@ -52,7 +52,7 @@ MA 02110-1301, USA. Quaternion _atmosphereOrientation; float _atmosphereRotationalVelocity; - unsigned _shuttlesOnGround; + NSUInteger _shuttlesOnGround; OOTimeDelta _lastLaunchTime; OOTimeDelta _shuttleLaunchInterval; diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index e734b6b2e..be8f56fe3 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -5404,7 +5404,7 @@ - (void) cycleMultiFunctionDisplay:(NSUInteger) index } JSContext *context = OOJSAcquireContext(); jsval keyVal = OOJSValueFromNativeObject(context,key); - ShipScriptEvent(context, self, "mfdKeyChanged", INT_TO_JSVAL(activeMFD), keyVal); + ShipScriptEvent(context, self, "mfdKeyChanged", INT_TO_JSVAL((int32)activeMFD), keyVal); OOJSRelinquishContext(context); } @@ -5415,7 +5415,7 @@ - (void) selectNextMultiFunctionDisplay NSUInteger mfdID = activeMFD + 1; [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ]; JSContext *context = OOJSAcquireContext(); - ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD)); + ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL((int32)activeMFD)); OOJSRelinquishContext(context); } @@ -6558,20 +6558,20 @@ - (int) legalStatus } -- (void) markAsOffender:(int)offence_value +- (void) markAsOffender:(OOCreditsQuantity)offence_value { [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown]; } -- (void) markAsOffender:(int)offence_value withReason:(OOLegalStatusReason)reason +- (void) markAsOffender:(OOCreditsQuantity)offence_value withReason:(OOLegalStatusReason)reason { if (![self isCloaked]) { JSContext *context = OOJSAcquireContext(); jsval amountVal = JSVAL_VOID; - int amountVal2 = (legalStatus | offence_value) - legalStatus; + OOCreditsQuantity amountVal2 = (legalStatus | offence_value) - legalStatus; JS_NewNumberValue(context, amountVal2, &amountVal); legalStatus |= offence_value; // can't set the new bounty until the size of the change is known diff --git a/src/Core/Entities/ShipEntity.h b/src/Core/Entities/ShipEntity.h index cb919eca3..87f153f0b 100644 --- a/src/Core/Entities/ShipEntity.h +++ b/src/Core/Entities/ShipEntity.h @@ -1163,8 +1163,8 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q Mark this ship as an offender, this is different to setBounty as some ships such as police are not markable. The final bounty may not be equal to existing bounty plus offence_value. */ -- (void) markAsOffender:(int)offence_value; -- (void) markAsOffender:(int)offence_value withReason:(OOLegalStatusReason)reason; +- (void) markAsOffender:(OOCreditsQuantity)offence_value; +- (void) markAsOffender:(OOCreditsQuantity)offence_value withReason:(OOLegalStatusReason)reason; - (void) switchLightsOn; - (void) switchLightsOff; diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index 113ae4d48..0712130a9 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -13564,13 +13564,13 @@ - (BOOL) witchspaceLeavingEffects } -- (void) markAsOffender:(int)offence_value +- (void) markAsOffender:(OOCreditsQuantity)offence_value { [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown]; } -- (void) markAsOffender:(int)offence_value withReason:(OOLegalStatusReason)reason +- (void) markAsOffender:(OOCreditsQuantity)offence_value withReason:(OOLegalStatusReason)reason { if (![self isPolice] && ![self isCloaked] && self != [UNIVERSE station]) { diff --git a/src/Core/GuiDisplayGen.m b/src/Core/GuiDisplayGen.m index 306e307cc..bd7287424 100644 --- a/src/Core/GuiDisplayGen.m +++ b/src/Core/GuiDisplayGen.m @@ -1782,7 +1782,6 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO (textRow-1) * MAIN_GUI_ROW_HEIGHT * pixelRatio); OOSystemID target = [PLAYER targetSystemID]; - NSString *targetName = [UNIVERSE getSystemName:target]; double dx, dy; // get a list of systems marked as contract destinations @@ -1893,10 +1892,9 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO { [self drawAdvancedNavArrayAtX:x+hoffset y:y+voffset z:z alpha:alpha usingRoute:nil optimizedBy:OPTIMIZED_BY_NONE zoom: zoom]; } - NSPoint targetCoordinates = (NSPoint){0,0}; if (!routeExists) { - targetCoordinates = [systemManager getCoordinatesForSystem:target inGalaxy:galaxy_id]; + NSPoint targetCoordinates = [systemManager getCoordinatesForSystem:target inGalaxy:galaxy_id]; distance = distanceBetweenPlanetPositions(targetCoordinates.x,targetCoordinates.y,galaxy_coordinates.x,galaxy_coordinates.y); if (distance == 0.0) @@ -2234,7 +2232,7 @@ - (void) drawStarChart:(GLfloat)x :(GLfloat)y :(GLfloat)z :(GLfloat) alpha :(BOO tab_stops[2] = 288; [self overrideTabs:tab_stops from:kGuiChartTraveltimeTabs length:3]; [self setTabStops:tab_stops]; - targetName = [[UNIVERSE getSystemName:target] retain]; + NSString *targetName = [[UNIVERSE getSystemName:target] retain]; // distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs NSString *travelDistLine = @""; diff --git a/src/Core/HeadUpDisplay.m b/src/Core/HeadUpDisplay.m index 15b48d81e..a3541f390 100644 --- a/src/Core/HeadUpDisplay.m +++ b/src/Core/HeadUpDisplay.m @@ -1182,8 +1182,6 @@ - (void) drawScanner:(NSDictionary *)info GLfloat scanner_color[4] = { 1.0, 0.0, 0.0, 1.0 }; BOOL emptyDial = ([info oo_floatForKey:ALPHA_KEY] == 0.0f); - - BOOL isHostile = NO; if (emptyDial) { @@ -1344,11 +1342,10 @@ - (void) drawScanner:(NSDictionary *)info y1 = z_factor * relativePosition.z; y2 = y1 + y_factor * relativePosition.y; - isHostile = NO; if ([scannedEntity isShip]) { ShipEntity *ship = (ShipEntity *)scannedEntity; - isHostile = (([ship hasHostileTarget])&&([ship primaryTarget] == PLAYER)); + BOOL isHostile = (([ship hasHostileTarget])&&([ship primaryTarget] == PLAYER)); GLfloat *base_col = [ship scannerDisplayColorForShip:PLAYER :isHostile :flash :[ship scannerDisplayColor1] :[ship scannerDisplayColor2] :[ship scannerDisplayColorHostile1] :[ship scannerDisplayColorHostile2] @@ -3030,7 +3027,6 @@ - (void) drawWeaponsOfflineText:(NSDictionary *)info { int x, y; NSSize siz; - GLfloat alpha = overallAlpha; struct CachedInfo cached; [(NSValue *)[sCurrentDrawItem objectAtIndex:WIDGET_CACHE] getValue:&cached]; @@ -3039,8 +3035,8 @@ - (void) drawWeaponsOfflineText:(NSDictionary *)info y = useDefined(cached.y, WEAPONSOFFLINETEXT_DISPLAY_Y) + [[UNIVERSE gameView] y_offset] * cached.y0; siz.width = useDefined(cached.width, WEAPONSOFFLINETEXT_WIDTH); siz.height = useDefined(cached.height, WEAPONSOFFLINETEXT_HEIGHT); - alpha *= cached.alpha; + textColor[3] = cached.alpha; GetRGBAArrayFromInfo(info, textColor); textColor[3] *= overallAlpha; diff --git a/src/Core/Materials/OOShaderProgram.m b/src/Core/Materials/OOShaderProgram.m index dfcb602a6..a8da65a45 100644 --- a/src/Core/Materials/OOShaderProgram.m +++ b/src/Core/Materials/OOShaderProgram.m @@ -304,8 +304,6 @@ - (id)initWithVertexShaderSource:(NSString *)vertexSource self = [super init]; if (self == nil) OK = NO; - standardMatrixUniformLocations = nil; - if (OK && vertexSource == nil && fragmentSource == nil) OK = NO; // Must have at least one shader! if (OK && prefixString != nil) diff --git a/src/Core/OOALSoundChannel.m b/src/Core/OOALSoundChannel.m index e732b8262..38aaeae00 100644 --- a/src/Core/OOALSoundChannel.m +++ b/src/Core/OOALSoundChannel.m @@ -53,9 +53,12 @@ - (id) init [self release]; self = nil; } - // sources are all relative to listener, defaulting to zero vector - OOAL(alSourcei(_source, AL_SOURCE_RELATIVE, AL_TRUE)); - OOAL(alSource3f(_source, AL_POSITION, 0.0f, 0.0f, 0.0f)); + else + { + // sources are all relative to listener, defaulting to zero vector + OOAL(alSourcei(_source, AL_SOURCE_RELATIVE, AL_TRUE)); + OOAL(alSource3f(_source, AL_POSITION, 0.0f, 0.0f, 0.0f)); + } } return self; } diff --git a/src/Core/OOJoystickManager.h b/src/Core/OOJoystickManager.h index 530783ed4..86a176e66 100644 --- a/src/Core/OOJoystickManager.h +++ b/src/Core/OOJoystickManager.h @@ -285,10 +285,10 @@ typedef struct - (double) getSensitivity; // Axis profile handling -- (void) setProfile: (OOJoystickAxisProfile *) profile forAxis:(int) axis; -- (OOJoystickAxisProfile *) getProfileForAxis: (int) axis; -- (void) saveProfileForAxis: (int) axis; -- (void) loadProfileForAxis: (int) axis; +- (void) setProfile: (OOJoystickAxisProfile *) profile forAxis:(NSUInteger) axis; +- (OOJoystickAxisProfile *) getProfileForAxis: (NSUInteger) axis; +- (void) saveProfileForAxis: (NSUInteger) axis; +- (void) loadProfileForAxis: (NSUInteger) axis; // This one just returns a pointer to the entire state array to // allow for multiple lookups with only one objc_sendMsg diff --git a/src/Core/OOJoystickManager.m b/src/Core/OOJoystickManager.m index c73be1a5c..dfbefaf19 100644 --- a/src/Core/OOJoystickManager.m +++ b/src/Core/OOJoystickManager.m @@ -164,7 +164,7 @@ - (double) getSensitivity return precisionMode ? STICK_PRECISIONFAC : 1.0; } -- (void) setProfile: (OOJoystickAxisProfile *) profile forAxis: (int) axis +- (void) setProfile: (OOJoystickAxisProfile *) profile forAxis: (NSUInteger) axis { switch (axis) { @@ -186,7 +186,7 @@ - (void) setProfile: (OOJoystickAxisProfile *) profile forAxis: (int) axis return; } -- (OOJoystickAxisProfile *) getProfileForAxis: (int) axis +- (OOJoystickAxisProfile *) getProfileForAxis: (NSUInteger) axis { switch (axis) { @@ -201,7 +201,7 @@ - (OOJoystickAxisProfile *) getProfileForAxis: (int) axis } -- (void) saveProfileForAxis: (int) axis +- (void) saveProfileForAxis: (NSUInteger) axis { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; @@ -260,7 +260,7 @@ - (void) saveProfileForAxis: (int) axis -- (void) loadProfileForAxis: (int) axis +- (void) loadProfileForAxis: (NSUInteger) axis { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *dict; diff --git a/src/Core/OOJoystickProfile.h b/src/Core/OOJoystickProfile.h index 19810b924..6a1061c1e 100644 --- a/src/Core/OOJoystickProfile.h +++ b/src/Core/OOJoystickProfile.h @@ -78,9 +78,9 @@ MA 02110-1301, USA. - (id) init; - (void) dealloc; - (id) copyWithZone: (NSZone *) zone; -- (int) addControl: (NSPoint) point; +- (NSInteger) addControl: (NSPoint) point; - (NSPoint) pointAtIndex: (NSInteger) index; -- (int) countPoints; +- (NSInteger) countPoints; - (void) removeControl: (NSInteger) index; - (void) clearControlPoints; - (void) moveControl: (NSInteger) index point: (NSPoint) point; diff --git a/src/Core/OOJoystickProfile.m b/src/Core/OOJoystickProfile.m index e96698a64..f9df8f03e 100644 --- a/src/Core/OOJoystickProfile.m +++ b/src/Core/OOJoystickProfile.m @@ -375,7 +375,7 @@ - (id) copyWithZone: (NSZone *) zone } -- (int) addControl: (NSPoint) point +- (NSInteger) addControl: (NSPoint) point { NSPoint left, right; NSUInteger i; @@ -438,7 +438,7 @@ - (NSPoint) pointAtIndex: (NSInteger) index return point; } -- (int) countPoints +- (NSInteger) countPoints { return [controlPoints count]; }