From d5e274aee70f883bb1e0a899846f33798c7b6da3 Mon Sep 17 00:00:00 2001 From: AnotherCommander Date: Fri, 12 Jul 2013 04:25:49 +0200 Subject: [PATCH 1/8] Made exhaust emissive color settable by user. The shipdata key 'exhaust_emissive_color' can be used on a per-ship basis for this purpose. --- src/Core/Entities/OOExhaustPlumeEntity.m | 4 +++- src/Core/Entities/ShipEntity.h | 3 +++ src/Core/Entities/ShipEntity.m | 28 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Core/Entities/OOExhaustPlumeEntity.m b/src/Core/Entities/OOExhaustPlumeEntity.m index ca130cf1..e8954400 100644 --- a/src/Core/Entities/OOExhaustPlumeEntity.m +++ b/src/Core/Entities/OOExhaustPlumeEntity.m @@ -112,7 +112,9 @@ static OOTexture *sPlumeTexture = nil; _trackTime = now; } - GLfloat ex_emissive[4] = {0.7f, 0.9, 1.0f, 0.9f * kOverallAlpha}; // pale blue + //GLfloat ex_emissive[4] = {0.7f, 0.9, 1.0f, 0.9f * kOverallAlpha}; // pale blue - old definition + GLfloat ex_emissive[4]; + [[ship exhaustEmissiveColor] getRed:&ex_emissive[0] green:&ex_emissive[1] blue:&ex_emissive[2] alpha:&ex_emissive[3]]; const GLfloat s1[8] = { 0.0, M_SQRT1_2, 1.0, M_SQRT1_2, 0.0, -M_SQRT1_2, -1.0, -M_SQRT1_2}; const GLfloat c1[8] = { 1.0, M_SQRT1_2, 0.0, -M_SQRT1_2, -1.0, -M_SQRT1_2, 0.0, M_SQRT1_2}; diff --git a/src/Core/Entities/ShipEntity.h b/src/Core/Entities/ShipEntity.h index f89bef07..99a043fb 100644 --- a/src/Core/Entities/ShipEntity.h +++ b/src/Core/Entities/ShipEntity.h @@ -211,6 +211,7 @@ typedef enum NSDictionary *dockingInstructions; OOColor *laser_color; + OOColor *exhaust_emissive_color; OOColor *scanner_display_color1; OOColor *scanner_display_color2; @@ -967,7 +968,9 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q - (BOOL) fireStarboardWeapon:(double)range; - (BOOL) fireTurretCannon:(double)range; - (void) setLaserColor:(OOColor *)color; +- (void) setExhaustEmissiveColor:(OOColor *)color; - (OOColor *)laserColor; +- (OOColor *)exhaustEmissiveColor; - (BOOL) fireSubentityLaserShot:(double)range; - (BOOL) fireDirectLaserShot:(double)range; - (BOOL) fireDirectLaserDefensiveShot; diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index b6f36fee..9b5762b7 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -362,9 +362,20 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other); if (octree) mass = (GLfloat)(density * 20.0 * [octree volume]); OOColor *color = [OOColor brightColorWithDescription:[shipDict objectForKey:@"laser_color"]]; + if (color == nil) color = [OOColor redColor]; [self setLaserColor:color]; + // exhaust emissive color + OORGBAComponents defaultExhaustEmissiveColorComponents; // pale blue is exhaust default color + defaultExhaustEmissiveColorComponents.r = 0.7f; + defaultExhaustEmissiveColorComponents.g = 0.9f; + defaultExhaustEmissiveColorComponents.b = 1.0f; + defaultExhaustEmissiveColorComponents.a = 0.9f; + color = [OOColor brightColorWithDescription:[shipDict objectForKey:@"exhaust_emissive_color"]]; + if (color == nil) color = [OOColor colorWithRGBAComponents:defaultExhaustEmissiveColorComponents]; + [self setExhaustEmissiveColor:color]; + [self clearSubEntities]; [self setUpSubEntities]; @@ -930,6 +941,7 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other); DESTROY(roleSet); DESTROY(primaryRole); DESTROY(laser_color); + DESTROY(exhaust_emissive_color); DESTROY(scanner_display_color1); DESTROY(scanner_display_color2); DESTROY(script); @@ -10101,12 +10113,28 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q } +- (void) setExhaustEmissiveColor:(OOColor *) color +{ + if (color) + { + [exhaust_emissive_color release]; + exhaust_emissive_color = [color retain]; + } +} + + - (OOColor *)laserColor { return [[laser_color retain] autorelease]; } +- (OOColor *)exhaustEmissiveColor +{ + return [[exhaust_emissive_color retain] autorelease]; +} + + - (BOOL) fireSubentityLaserShot:(double)range { [self setShipHitByLaser:nil]; From 930a9ce659a0ebbc9790ada71c2f9c4ed6ff7e7d Mon Sep 17 00:00:00 2001 From: cim Date: Fri, 12 Jul 2013 20:38:40 +0100 Subject: [PATCH 2/8] Remove unnecessary debug lines --- src/Core/Entities/ShipEntity.m | 1 - src/Core/Entities/ShipEntityAI.m | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index 9b5762b7..430c9826 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -12382,7 +12382,6 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q - (NSDictionary *) dockingInstructions { - OOLog(@"docking.debug",@"%@",dockingInstructions); return dockingInstructions; } diff --git a/src/Core/Entities/ShipEntityAI.m b/src/Core/Entities/ShipEntityAI.m index 9abb6a49..6c8b55e2 100644 --- a/src/Core/Entities/ShipEntityAI.m +++ b/src/Core/Entities/ShipEntityAI.m @@ -523,7 +523,6 @@ message = [dockingInstructions objectForKey:@"comms_message"]; if (message != nil) [station sendExpandedMessage:message toShip:self]; } - OOLog(@"docking.debug",@"%@",dockingInstructions); } else { From 185ea13e56f769e10e8c4ede019b55309625e04d Mon Sep 17 00:00:00 2001 From: AnotherCommander Date: Mon, 15 Jul 2013 05:12:01 +0200 Subject: [PATCH 3/8] Made exhaust emissive color accessible from JS via the read/write exhaustEmissiveColor ship property. --- src/Core/Scripting/OOJSShip.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Core/Scripting/OOJSShip.m b/src/Core/Scripting/OOJSShip.m index d52fb4e4..7f980e6f 100644 --- a/src/Core/Scripting/OOJSShip.m +++ b/src/Core/Scripting/OOJSShip.m @@ -177,6 +177,7 @@ enum kShip_equipment, // the ship's equipment, array of EquipmentInfo, read only kShip_escortGroup, // group, ShipGroup, read-only kShip_escorts, // deployed escorts, array of Ship, read-only + kShip_exhaustEmissiveColor, // exhaust emissive color, array, read/write kShip_extraCargo, // cargo space increase granted by large cargo bay, int, read-only kShip_forwardWeapon, // the ship's forward weapon, equipmentType, read/write kShip_fuel, // fuel, float, read/write @@ -294,13 +295,14 @@ static JSPropertySpec sShipProperties[] = { "desiredSpeed", kShip_desiredSpeed, OOJS_PROP_READWRITE_CB }, { "destination", kShip_destination, OOJS_PROP_READWRITE_CB }, { "displayName", kShip_displayName, OOJS_PROP_READWRITE_CB }, - { "dockingInstructions", kShip_dockingInstructions, OOJS_PROP_READONLY_CB }, + { "dockingInstructions", kShip_dockingInstructions, OOJS_PROP_READONLY_CB }, { "energyRechargeRate", kShip_energyRechargeRate, OOJS_PROP_READONLY_CB }, { "entityPersonality", kShip_entityPersonality, OOJS_PROP_READONLY_CB }, { "equipment", kShip_equipment, OOJS_PROP_READONLY_CB }, { "escorts", kShip_escorts, OOJS_PROP_READONLY_CB }, { "escortGroup", kShip_escortGroup, OOJS_PROP_READONLY_CB }, - { "extraCargo", kShip_extraCargo, OOJS_PROP_READONLY_CB }, + { "exhaustEmissiveColor", kShip_exhaustEmissiveColor, OOJS_PROP_READWRITE_CB }, + { "extraCargo", kShip_extraCargo, OOJS_PROP_READONLY_CB }, { "forwardWeapon", kShip_forwardWeapon, OOJS_PROP_READWRITE_CB }, { "fuel", kShip_fuel, OOJS_PROP_READWRITE_CB }, { "fuelChargeRate", kShip_fuelChargeRate, OOJS_PROP_READONLY_CB }, @@ -903,6 +905,10 @@ static JSBool ShipGetProperty(JSContext *context, JSObject *this, jsid propID, j result = [[entity scannerDisplayColor2] normalizedArray]; break; + case kShip_exhaustEmissiveColor: + result = [[entity exhaustEmissiveColor] normalizedArray]; + break; + case kShip_maxThrust: return JS_NewNumberValue(context, [entity maxThrust], value); @@ -1271,6 +1277,15 @@ static JSBool ShipSetProperty(JSContext *context, JSObject *this, jsid propID, J } break; + case kShip_exhaustEmissiveColor: + colorForScript = [OOColor colorWithDescription:OOJSNativeObjectFromJSValue(context, *value)]; + if (colorForScript != nil || JSVAL_IS_NULL(*value)) + { + [entity setExhaustEmissiveColor:colorForScript]; + return YES; + } + break; + case kShip_scriptedMisjump: if (JS_ValueToBoolean(context, *value, &bValue)) { From f7a664f18cec1d2e9d64aa47a0f610fe606b436d Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Mon, 15 Jul 2013 20:56:07 +0200 Subject: [PATCH 4/8] Add OOHPVector and OOJSPopulatorDefinition to Xcode project --- Oolite.xcodeproj/project.pbxproj | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Oolite.xcodeproj/project.pbxproj b/Oolite.xcodeproj/project.pbxproj index 2d7da73d..9f1928be 100644 --- a/Oolite.xcodeproj/project.pbxproj +++ b/Oolite.xcodeproj/project.pbxproj @@ -663,6 +663,10 @@ 1AD1F4FF0CD9E83700EAE520 /* NSThreadOOExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD1F4C80CD9E42A00EAE520 /* NSThreadOOExtensions.m */; }; 1AD1F5000CD9E83800EAE520 /* NSThreadOOExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD1F4C70CD9E42A00EAE520 /* NSThreadOOExtensions.h */; }; 1AD3C339163A92F600469C4D /* OOOpenGLStateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3C338163A92F600469C4D /* OOOpenGLStateManager.m */; }; + 1AD8522517947BD600CBE743 /* OOHPVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD8522317947BD600CBE743 /* OOHPVector.h */; }; + 1AD8522617947BD600CBE743 /* OOHPVector.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8522417947BD600CBE743 /* OOHPVector.m */; }; + 1AD8522E17947C9500CBE743 /* OOJSPopulatorDefinition.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD8522C17947C9400CBE743 /* OOJSPopulatorDefinition.h */; }; + 1AD8522F17947C9500CBE743 /* OOJSPopulatorDefinition.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8522D17947C9500CBE743 /* OOJSPopulatorDefinition.m */; }; 1ADA564810CD68D800E891B8 /* OOStellarBody.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ADA564710CD68D800E891B8 /* OOStellarBody.h */; }; 1ADA8AB30F42DBA80001BEC9 /* OODeepCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ADA8AB10F42DBA80001BEC9 /* OODeepCopy.h */; }; 1ADA8AB40F42DBA80001BEC9 /* OODeepCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADA8AB20F42DBA80001BEC9 /* OODeepCopy.m */; }; @@ -1972,6 +1976,10 @@ 1AD3C338163A92F600469C4D /* OOOpenGLStateManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOpenGLStateManager.m; sourceTree = ""; }; 1AD5A81A12D3A9FD00B62503 /* exports-debug-32.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; name = "exports-debug-32.exp"; path = "src/Cocoa/exports-debug-32.exp"; sourceTree = ""; }; 1AD5A81B12D3A9FD00B62503 /* exports-debug-64.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; name = "exports-debug-64.exp"; path = "src/Cocoa/exports-debug-64.exp"; sourceTree = ""; }; + 1AD8522317947BD600CBE743 /* OOHPVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOHPVector.h; sourceTree = ""; }; + 1AD8522417947BD600CBE743 /* OOHPVector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOHPVector.m; sourceTree = ""; }; + 1AD8522C17947C9400CBE743 /* OOJSPopulatorDefinition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJSPopulatorDefinition.h; sourceTree = ""; }; + 1AD8522D17947C9500CBE743 /* OOJSPopulatorDefinition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOJSPopulatorDefinition.m; sourceTree = ""; }; 1AD88FAF103F29D300AA36F4 /* oolite-options.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "oolite-options.xcconfig"; path = "src/Cocoa/oolite-options.xcconfig"; sourceTree = ""; }; 1ADA564710CD68D800E891B8 /* OOStellarBody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOStellarBody.h; sourceTree = ""; }; 1ADA8AB10F42DBA80001BEC9 /* OODeepCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OODeepCopy.h; sourceTree = ""; }; @@ -2732,6 +2740,8 @@ 1A0942C812D7C011003B6273 /* OOJSFrameCallbacks.m */, 1A38E9E11603C7A500EE19F1 /* OOJSInterfaceDefinition.h */, 1A38E9E21603C7A500EE19F1 /* OOJSInterfaceDefinition.m */, + 1AD8522C17947C9400CBE743 /* OOJSPopulatorDefinition.h */, + 1AD8522D17947C9500CBE743 /* OOJSPopulatorDefinition.m */, ); name = JavaScript; sourceTree = ""; @@ -3110,6 +3120,8 @@ 1A9404920BAF4582005F6CF3 /* OOMaths.h */, 1A9404A10BAF462D005F6CF3 /* OOVector.h */, 1A9404A20BAF462D005F6CF3 /* OOVector.m */, + 1AD8522317947BD600CBE743 /* OOHPVector.h */, + 1AD8522417947BD600CBE743 /* OOHPVector.m */, 1A9405360BAF4FA6005F6CF3 /* OOMatrix.h */, 1A9405370BAF4FA6005F6CF3 /* OOMatrix.m */, 1A94057D0BAF52AD005F6CF3 /* OOQuaternion.h */, @@ -3580,6 +3592,8 @@ 1A401F8815E7AF7B004CDF95 /* OOPrimaryWindow.h in Headers */, 1A38E9E31603C7A500EE19F1 /* OOJSInterfaceDefinition.h in Headers */, 1AAEE9DA161F7523003A5A1E /* OOStringExpander.h in Headers */, + 1AD8522517947BD600CBE743 /* OOHPVector.h in Headers */, + 1AD8522E17947C9500CBE743 /* OOJSPopulatorDefinition.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4058,6 +4072,8 @@ 1A38E9E41603C7A500EE19F1 /* OOJSInterfaceDefinition.m in Sources */, 1AAEE9DB161F7523003A5A1E /* OOStringExpander.m in Sources */, 1AD3C339163A92F600469C4D /* OOOpenGLStateManager.m in Sources */, + 1AD8522617947BD600CBE743 /* OOHPVector.m in Sources */, + 1AD8522F17947C9500CBE743 /* OOJSPopulatorDefinition.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 0a0885d91f89956a6a99877bc641195b299cf55a Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Mon, 15 Jul 2013 20:58:01 +0200 Subject: [PATCH 5/8] Fix .gitignore excluding src/Core on case-insensitive file systems --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4874804a..a94244f4 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ DebugOXP/requires.plist AddOns/ # Debug output -core +/core From 34588377cdc031e4055be4692ca140257a3bed9a Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Mon, 15 Jul 2013 20:58:49 +0200 Subject: [PATCH 6/8] Sign hygiene --- src/Core/Universe.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 1ed1d6af..9742e873 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -1266,18 +1266,18 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC NSEnumerator *enumerator = [[blocks sortedArrayUsingFunction:populatorPrioritySort context:nil] objectEnumerator]; NSDictionary *populator; HPVector location; - int locationSeed, groupCount, rndvalue; - unsigned i; + unsigned i, locationSeed, groupCount, rndvalue; RANROTSeed rndcache, rndlocal; NSString *locationCode; OOJSPopulatorDefinition *pdef; - while ((populator = [enumerator nextObject])) { + while ((populator = [enumerator nextObject])) + { // for now, the "deterministic" setting does nothing - locationSeed = [populator oo_intForKey:@"locationSeed" defaultValue:0]; - groupCount = [populator oo_intForKey:@"groupCount" defaultValue:1]; + locationSeed = [populator oo_unsignedIntForKey:@"locationSeed" defaultValue:0]; + groupCount = [populator oo_unsignedIntForKey:@"groupCount" defaultValue:1]; - for (i=0;i Date: Mon, 15 Jul 2013 20:59:49 +0200 Subject: [PATCH 7/8] Bump Mac-specific --- Mac-specific | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mac-specific b/Mac-specific index 78e78821..624478f8 160000 --- a/Mac-specific +++ b/Mac-specific @@ -1 +1 @@ -Subproject commit 78e78821865f8751378e695ccd37598c0e0f31b8 +Subproject commit 624478f8d255e171fde9ce63401ce9ce7bc2603d From f437d81a1287ab2d6bd2dcf73fd3e2cbccf5a30f Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Mon, 15 Jul 2013 21:00:07 +0200 Subject: [PATCH 8/8] Remove some unused things --- src/Core/Entities/DustEntity.m | 3 --- src/Core/Materials/OOShaderUniform.m | 6 ------ src/Core/Universe.m | 2 -- 3 files changed, 11 deletions(-) diff --git a/src/Core/Entities/DustEntity.m b/src/Core/Entities/DustEntity.m index 6642b59e..25a62b6f 100644 --- a/src/Core/Entities/DustEntity.m +++ b/src/Core/Entities/DustEntity.m @@ -161,9 +161,6 @@ enum if (shaderMode == kShaderModeOn) return; #endif - PlayerEntity* player = PLAYER; - assert(player != nil); - zero_distance = 0.0; Vector offset = vector_flip(cameraRelativePosition); diff --git a/src/Core/Materials/OOShaderUniform.m b/src/Core/Materials/OOShaderUniform.m index 9d618c7e..5c61ae49 100644 --- a/src/Core/Materials/OOShaderUniform.m +++ b/src/Core/Materials/OOShaderUniform.m @@ -38,12 +38,6 @@ SOFTWARE. #import "OOShaderUniformMethodType.h" -OOINLINE BOOL ValidBindingType(OOShaderUniformType type) -{ - return kOOShaderUniformTypeInt <= type && type <= kOOShaderUniformTypeDouble; -} - - @interface OOShaderUniform (OOPrivate) - (id)initWithName:(NSString *)uniformName shaderProgram:(OOShaderProgram *)shaderProgram; diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 9742e873..e4e112d4 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -104,8 +104,6 @@ enum #define MAX_NUMBER_OF_ENTITIES 200 #define STANDARD_STATION_ROLL 0.4 -#define WOLFPACK_SHIPS_DISTANCE 0.1 -#define FIXED_ASTEROID_FIELDS 0 // currently twice scanner radius #define LANE_WIDTH 51200.0