Implemented JS sound interface. Moved some more generic JS ObjC wrapper stuff into OOJavaScriptEngine.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1340 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-02-03 02:16:23 +00:00
parent 907340dfc8
commit f11b6fae14
14 changed files with 679 additions and 50 deletions

View File

@ -292,6 +292,8 @@
1A27DB3D0C4E349F00CB4CE8 /* OOOXPVerifierStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A27DB3A0C4E349F00CB4CE8 /* OOOXPVerifierStage.m */; }; 1A27DB3D0C4E349F00CB4CE8 /* OOOXPVerifierStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A27DB3A0C4E349F00CB4CE8 /* OOOXPVerifierStage.m */; };
1A27DB420C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A27DB400C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h */; }; 1A27DB420C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A27DB400C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h */; };
1A27DB430C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A27DB410C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m */; }; 1A27DB430C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A27DB410C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m */; };
1A28AA160D55438200BC0CE4 /* OOJSSound.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A28AA140D55438200BC0CE4 /* OOJSSound.h */; };
1A28AA170D55438200BC0CE4 /* OOJSSound.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A28AA150D55438200BC0CE4 /* OOJSSound.m */; };
1A29967E0B9F064C002D2149 /* OOCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A29967C0B9F064C002D2149 /* OOCache.h */; }; 1A29967E0B9F064C002D2149 /* OOCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A29967C0B9F064C002D2149 /* OOCache.h */; };
1A29967F0B9F064C002D2149 /* OOCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A29967D0B9F064C002D2149 /* OOCache.m */; }; 1A29967F0B9F064C002D2149 /* OOCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A29967D0B9F064C002D2149 /* OOCache.m */; };
1A2A16680BD10B1200152975 /* OOSingleTextureMaterial.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A16660BD10B1200152975 /* OOSingleTextureMaterial.m */; }; 1A2A16680BD10B1200152975 /* OOSingleTextureMaterial.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A16660BD10B1200152975 /* OOSingleTextureMaterial.m */; };
@ -483,6 +485,8 @@
1AB2AAFA0C4CE0CC0008CF4E /* OOOXPVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB2AAF80C4CE0CC0008CF4E /* OOOXPVerifier.h */; }; 1AB2AAFA0C4CE0CC0008CF4E /* OOOXPVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB2AAF80C4CE0CC0008CF4E /* OOOXPVerifier.h */; };
1AB2AAFB0C4CE0CC0008CF4E /* OOOXPVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AB2AAF90C4CE0CC0008CF4E /* OOOXPVerifier.m */; }; 1AB2AAFB0C4CE0CC0008CF4E /* OOOXPVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AB2AAF90C4CE0CC0008CF4E /* OOOXPVerifier.m */; };
1AB2AB130C4CE4070008CF4E /* verifyOXP.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1AB2AB120C4CE4070008CF4E /* verifyOXP.plist */; }; 1AB2AB130C4CE4070008CF4E /* verifyOXP.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1AB2AB120C4CE4070008CF4E /* verifyOXP.plist */; };
1AB784F90D554F7B00517983 /* OOJSSoundSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB784F70D554F7B00517983 /* OOJSSoundSource.h */; };
1AB784FA0D554F7B00517983 /* OOJSSoundSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AB784F80D554F7B00517983 /* OOJSSoundSource.m */; };
1ABB688C0D044306008BE96D /* OOLoggingExtended.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABB688B0D044306008BE96D /* OOLoggingExtended.h */; }; 1ABB688C0D044306008BE96D /* OOLoggingExtended.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABB688B0D044306008BE96D /* OOLoggingExtended.h */; };
1AC544FA0D4D217900C90E5B /* oolite-font.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AC544F90D4D217900C90E5B /* oolite-font.png */; }; 1AC544FA0D4D217900C90E5B /* oolite-font.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AC544F90D4D217900C90E5B /* oolite-font.png */; };
1AC545060D4D228400C90E5B /* OOEncodingConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC545040D4D228400C90E5B /* OOEncodingConverter.h */; }; 1AC545060D4D228400C90E5B /* OOEncodingConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC545040D4D228400C90E5B /* OOEncodingConverter.h */; };
@ -977,7 +981,7 @@
083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = "<group>"; }; 083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = "<group>"; };
083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = "<group>"; }; 083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = "<group>"; };
083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = "<group>"; }; 083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = "<group>"; };
0865432206B8447D000CA0AB /* Oolite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oolite.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0865432206B8447D000CA0AB /* OoliteDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoliteDev.app; sourceTree = BUILT_PRODUCTS_DIR; };
0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; 0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = "<group>"; }; 1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = "<group>"; };
@ -1245,6 +1249,8 @@
1A27DB3A0C4E349F00CB4CE8 /* OOOXPVerifierStage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOXPVerifierStage.m; sourceTree = "<group>"; }; 1A27DB3A0C4E349F00CB4CE8 /* OOOXPVerifierStage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOXPVerifierStage.m; sourceTree = "<group>"; };
1A27DB400C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOFileScannerVerifierStage.h; sourceTree = "<group>"; }; 1A27DB400C4E34B300CB4CE8 /* OOFileScannerVerifierStage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOFileScannerVerifierStage.h; sourceTree = "<group>"; };
1A27DB410C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOFileScannerVerifierStage.m; sourceTree = "<group>"; }; 1A27DB410C4E34B300CB4CE8 /* OOFileScannerVerifierStage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOFileScannerVerifierStage.m; sourceTree = "<group>"; };
1A28AA140D55438200BC0CE4 /* OOJSSound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJSSound.h; sourceTree = "<group>"; };
1A28AA150D55438200BC0CE4 /* OOJSSound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOJSSound.m; sourceTree = "<group>"; };
1A29967C0B9F064C002D2149 /* OOCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOCache.h; sourceTree = "<group>"; }; 1A29967C0B9F064C002D2149 /* OOCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOCache.h; sourceTree = "<group>"; };
1A29967D0B9F064C002D2149 /* OOCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOCache.m; sourceTree = "<group>"; }; 1A29967D0B9F064C002D2149 /* OOCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOCache.m; sourceTree = "<group>"; };
1A2A16660BD10B1200152975 /* OOSingleTextureMaterial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOSingleTextureMaterial.m; sourceTree = "<group>"; }; 1A2A16660BD10B1200152975 /* OOSingleTextureMaterial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOSingleTextureMaterial.m; sourceTree = "<group>"; };
@ -1443,6 +1449,8 @@
1AB2AAF80C4CE0CC0008CF4E /* OOOXPVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOOXPVerifier.h; sourceTree = "<group>"; }; 1AB2AAF80C4CE0CC0008CF4E /* OOOXPVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOOXPVerifier.h; sourceTree = "<group>"; };
1AB2AAF90C4CE0CC0008CF4E /* OOOXPVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOXPVerifier.m; sourceTree = "<group>"; }; 1AB2AAF90C4CE0CC0008CF4E /* OOOXPVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOXPVerifier.m; sourceTree = "<group>"; };
1AB2AB120C4CE4070008CF4E /* verifyOXP.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = verifyOXP.plist; path = ../../../Resources/Config/verifyOXP.plist; sourceTree = "<group>"; }; 1AB2AB120C4CE4070008CF4E /* verifyOXP.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = verifyOXP.plist; path = ../../../Resources/Config/verifyOXP.plist; sourceTree = "<group>"; };
1AB784F70D554F7B00517983 /* OOJSSoundSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJSSoundSource.h; sourceTree = "<group>"; };
1AB784F80D554F7B00517983 /* OOJSSoundSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOJSSoundSource.m; sourceTree = "<group>"; };
1ABB688B0D044306008BE96D /* OOLoggingExtended.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOLoggingExtended.h; sourceTree = "<group>"; }; 1ABB688B0D044306008BE96D /* OOLoggingExtended.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOLoggingExtended.h; sourceTree = "<group>"; };
1AC0E9460B974DC200C46994 /* GPL.TXT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL.TXT; sourceTree = "<group>"; }; 1AC0E9460B974DC200C46994 /* GPL.TXT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL.TXT; sourceTree = "<group>"; };
1AC0E9470B974DC200C46994 /* FAQ.TXT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FAQ.TXT; sourceTree = "<group>"; }; 1AC0E9470B974DC200C46994 /* FAQ.TXT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FAQ.TXT; sourceTree = "<group>"; };
@ -1612,7 +1620,7 @@
19C28FACFE9D520D11CA2CBB /* Products */ = { 19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0865432206B8447D000CA0AB /* Oolite.app */, 0865432206B8447D000CA0AB /* OoliteDev.app */,
1A71E6F30BCE340C00CD5C13 /* libpng.a */, 1A71E6F30BCE340C00CD5C13 /* libpng.a */,
); );
name = Products; name = Products;
@ -1938,6 +1946,38 @@
name = PlayerEntity; name = PlayerEntity;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
1A28AA0F0D55434800BC0CE4 /* Sound */ = {
isa = PBXGroup;
children = (
1A28AA140D55438200BC0CE4 /* OOJSSound.h */,
1A28AA150D55438200BC0CE4 /* OOJSSound.m */,
1AB784F70D554F7B00517983 /* OOJSSoundSource.h */,
1AB784F80D554F7B00517983 /* OOJSSoundSource.m */,
);
name = Sound;
sourceTree = "<group>";
};
1A28AA130D55435300BC0CE4 /* Global */ = {
isa = PBXGroup;
children = (
1A7376BC0C64AE330097AC37 /* OOJSSystem.h */,
1A7376BD0C64AE330097AC37 /* OOJSSystem.m */,
1A4FB3330C8DC86800DC8E1F /* OOJSOolite.h */,
1A4FB3340C8DC86800DC8E1F /* OOJSOolite.m */,
1ACEA6BD0C91DA3E00C7CE97 /* OOJSGlobal.h */,
1ACEA6BE0C91DA3E00C7CE97 /* OOJSGlobal.m */,
1ACEA7260C91DF2800C7CE97 /* OOJSMissionVariables.h */,
1ACEA7270C91DF2800C7CE97 /* OOJSMissionVariables.m */,
1ACEA7A80C91E32800C7CE97 /* OOJSMission.h */,
1ACEA7A90C91E32800C7CE97 /* OOJSMission.m */,
1A6B25EC0C9C2745000717CF /* OOJSClock.h */,
1A6B25ED0C9C2746000717CF /* OOJSClock.m */,
1AA82C810CC10E3D0023B797 /* OOJSWorldScripts.h */,
1AA82C820CC10E3D0023B797 /* OOJSWorldScripts.m */,
);
name = Global;
sourceTree = "<group>";
};
1A2A1B020BD2768300152975 /* Graphics */ = { 1A2A1B020BD2768300152975 /* Graphics */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -2068,33 +2108,21 @@
1A5DBAB50BC000E700D57389 /* JavaScript */ = { 1A5DBAB50BC000E700D57389 /* JavaScript */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
1A5DBA9C0BC000DC00D57389 /* OOJSScript.h */,
1A5DBA9D0BC000DC00D57389 /* OOJSScript.m */,
1A5DBA9A0BC000DC00D57389 /* OOJavaScriptEngine.h */, 1A5DBA9A0BC000DC00D57389 /* OOJavaScriptEngine.h */,
1A5DBA9B0BC000DC00D57389 /* OOJavaScriptEngine.m */, 1A5DBA9B0BC000DC00D57389 /* OOJavaScriptEngine.m */,
1A43A0D10CB91D3600D0E239 /* Entities */,
1A28AA0F0D55434800BC0CE4 /* Sound */,
1A28AA130D55435300BC0CE4 /* Global */,
1A5DBA9C0BC000DC00D57389 /* OOJSScript.h */,
1A5DBA9D0BC000DC00D57389 /* OOJSScript.m */,
1A736C7D0C61FD220097AC37 /* OOJSCall.h */, 1A736C7D0C61FD220097AC37 /* OOJSCall.h */,
1A736C7E0C61FD220097AC37 /* OOJSCall.m */, 1A736C7E0C61FD220097AC37 /* OOJSCall.m */,
1A3AFF1D0BC4462200B5E2D9 /* OOJSVector.h */, 1A3AFF1D0BC4462200B5E2D9 /* OOJSVector.h */,
1A3AFF1E0BC4462200B5E2D9 /* OOJSVector.m */, 1A3AFF1E0BC4462200B5E2D9 /* OOJSVector.m */,
1A2A91500BC6BC66001E00FB /* OOJSQuaternion.h */, 1A2A91500BC6BC66001E00FB /* OOJSQuaternion.h */,
1A2A91510BC6BC66001E00FB /* OOJSQuaternion.m */, 1A2A91510BC6BC66001E00FB /* OOJSQuaternion.m */,
1A43A0D10CB91D3600D0E239 /* Entities */,
1A7376BC0C64AE330097AC37 /* OOJSSystem.h */,
1A7376BD0C64AE330097AC37 /* OOJSSystem.m */,
1A4FB3330C8DC86800DC8E1F /* OOJSOolite.h */,
1A4FB3340C8DC86800DC8E1F /* OOJSOolite.m */,
1ACEA6BD0C91DA3E00C7CE97 /* OOJSGlobal.h */,
1ACEA6BE0C91DA3E00C7CE97 /* OOJSGlobal.m */,
1ACEA7260C91DF2800C7CE97 /* OOJSMissionVariables.h */,
1ACEA7270C91DF2800C7CE97 /* OOJSMissionVariables.m */,
1ACEA7A80C91E32800C7CE97 /* OOJSMission.h */,
1ACEA7A90C91E32800C7CE97 /* OOJSMission.m */,
1A6B228B0C9B40D4000717CF /* OOJSTimer.h */, 1A6B228B0C9B40D4000717CF /* OOJSTimer.h */,
1A6B228C0C9B40D4000717CF /* OOJSTimer.m */, 1A6B228C0C9B40D4000717CF /* OOJSTimer.m */,
1A6B25EC0C9C2745000717CF /* OOJSClock.h */,
1A6B25ED0C9C2746000717CF /* OOJSClock.m */,
1AA82C810CC10E3D0023B797 /* OOJSWorldScripts.h */,
1AA82C820CC10E3D0023B797 /* OOJSWorldScripts.m */,
); );
name = JavaScript; name = JavaScript;
sourceTree = "<group>"; sourceTree = "<group>";
@ -2720,6 +2748,8 @@
1ABB688C0D044306008BE96D /* OOLoggingExtended.h in Headers */, 1ABB688C0D044306008BE96D /* OOLoggingExtended.h in Headers */,
1A1D212E0D2BD4C100F4DEC2 /* bsd_string.h in Headers */, 1A1D212E0D2BD4C100F4DEC2 /* bsd_string.h in Headers */,
1AC545060D4D228400C90E5B /* OOEncodingConverter.h in Headers */, 1AC545060D4D228400C90E5B /* OOEncodingConverter.h in Headers */,
1A28AA160D55438200BC0CE4 /* OOJSSound.h in Headers */,
1AB784F90D554F7B00517983 /* OOJSSoundSource.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -2769,7 +2799,7 @@
name = Oolite; name = Oolite;
productInstallPath = "$(HOME)/Applications"; productInstallPath = "$(HOME)/Applications";
productName = Oolite; productName = Oolite;
productReference = 0865432206B8447D000CA0AB /* Oolite.app */; productReference = 0865432206B8447D000CA0AB /* OoliteDev.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = { 1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = {
@ -3074,6 +3104,8 @@
1A7C75C30CC39EC3005D0AA2 /* OOJSSun.m in Sources */, 1A7C75C30CC39EC3005D0AA2 /* OOJSSun.m in Sources */,
1AD1F4FF0CD9E83700EAE520 /* NSThreadOOExtensions.m in Sources */, 1AD1F4FF0CD9E83700EAE520 /* NSThreadOOExtensions.m in Sources */,
1AC545070D4D228400C90E5B /* OOEncodingConverter.m in Sources */, 1AC545070D4D228400C90E5B /* OOEncodingConverter.m in Sources */,
1A28AA170D55438200BC0CE4 /* OOJSSound.m in Sources */,
1AB784FA0D554F7B00517983 /* OOJSSoundSource.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -39,8 +39,6 @@ BOOL JSEntityGetEntity(JSContext *context, JSObject *entityObj, Entity **outEnti
JSClass *JSEntityClass(void); JSClass *JSEntityClass(void);
JSObject *JSEntityPrototype(void); JSObject *JSEntityPrototype(void);
JSBool JSEntityEquality(JSContext *context, JSObject *this, jsval value, JSBool *outEqual);
/* EntityFromArgumentList() /* EntityFromArgumentList()

View File

@ -66,7 +66,7 @@ static JSExtendedClass sEntityClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS
@ -178,14 +178,8 @@ BOOL JSValueToEntity(JSContext *context, jsval value, Entity **outEntity)
BOOL JSEntityGetEntity(JSContext *context, JSObject *entityObj, Entity **outEntity) BOOL JSEntityGetEntity(JSContext *context, JSObject *entityObj, Entity **outEntity)
{ {
if (outEntity == NULL) return NO; if (outEntity == NULL) return NO;
*outEntity = nil; *outEntity = JSObjectToObjectOfClass(context, entityObj, [Entity class]);
if (entityObj == NULL) return NO; return *outEntity != nil;
*outEntity = JSObjectToObject(context, entityObj);
if ([*outEntity isKindOfClass:[Entity class]]) return YES;
*outEntity = nil;
return NO;
} }
@ -228,19 +222,6 @@ BOOL EntityFromArgumentList(JSContext *context, NSString *scriptClass, NSString
} }
JSBool JSEntityEquality(JSContext *context, JSObject *this, jsval value, JSBool *outEqual)
{
Entity *thisEnt, *thatEnt;
// No failures or diagnostic messages.
JSEntityGetEntity(context, this, &thisEnt);
JSValueToEntity(context, value, &thatEnt);
*outEqual = [thisEnt isEqual:thatEnt]; // Note ![nil isEqual:nil], so two stale entity refs will not be equal.
return YES;
}
static JSBool EntityGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue) static JSBool EntityGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue)
{ {
Entity *entity = nil; Entity *entity = nil;

View File

@ -56,7 +56,7 @@ static JSExtendedClass sPlanetClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS

View File

@ -69,7 +69,7 @@ static JSExtendedClass sPlayerClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS

View File

@ -66,7 +66,7 @@ static JSExtendedClass sShipClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS

View File

@ -0,0 +1,42 @@
/*
OOJSSound.h
JavaScript sound object.
Oolite
Copyright (C) 2004-2008 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
#import <jsapi.h>
@class OOSound;
void InitOOJSSound(JSContext *context, JSObject *global);
BOOL JSSoundGetSound(JSContext *context, JSObject *soundObj, OOSound **outSound);
/* SoundFromJSValue()
Convert a JS value to a sound. The value may be either a Sound object or a
string specifying a sound name.
*/
OOSound *SoundFromJSValue(JSContext *context, jsval value);

View File

@ -0,0 +1,194 @@
/*
OOJSSound.m
Oolite
Copyright (C) 2004-2007 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOJSSound.h"
#import "OOJavaScriptEngine.h"
#import "OOSound.h"
#import "ResourceManager.h"
static JSObject *sSoundPrototype;
static JSBool SoundGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
// Static methods
static JSBool SoundStaticLoad(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSExtendedClass sSoundClass =
{
{
"Sound",
JSCLASS_HAS_PRIVATE | JSCLASS_IS_EXTENDED,
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
SoundGetProperty, // getProperty
JS_PropertyStub, // setProperty
JS_EnumerateStub, // enumerate
JS_ResolveStub, // resolve
JS_ConvertStub, // convert
JSObjectWrapperFinalize, // finalize
JSCLASS_NO_OPTIONAL_MEMBERS
},
JSObjectWrapperEquality, // equality. Relies on the fact that the resource manager will always return the same object for a given sound name.
NULL, // outerObject
NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS
};
enum
{
// Property IDs
kSound_name
};
static JSPropertySpec sSoundProperties[] =
{
// JS name ID flags
{ "name", kSound_name, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
{ 0 }
};
static JSFunctionSpec sSoundMethods[] =
{
// JS name Function min args
{ "toString", JSObjectWrapperToString, 0, },
{ 0 }
};
static JSFunctionSpec sSoundStaticMethods[] =
{
// JS name Function min args
{ "load", SoundStaticLoad, 1, },
{ 0 }
};
// *** Public ***
void InitOOJSSound(JSContext *context, JSObject *global)
{
sSoundPrototype = JS_InitClass(context, global, NULL, &sSoundClass.base, NULL, 0, sSoundProperties, sSoundMethods, NULL, sSoundStaticMethods);
JSRegisterObjectConverter(&sSoundClass.base, JSBasicPrivateObjectConverter);
}
BOOL JSSoundGetSound(JSContext *context, JSObject *soundObj, OOSound **outSound)
{
if (outSound == NULL) return NO;
*outSound = JSObjectToObjectOfClass(context, soundObj, [OOSound class]);
return *outSound != nil;
}
OOSound *SoundFromJSValue(JSContext *context, jsval value)
{
if (JSVAL_IS_STRING(value))
{
return [ResourceManager ooSoundNamed:JSValToNSString(context, value) inFolder:@"Sounds"];
}
else
{
return JSValueToObjectOfClass(context, value, [OOSound class]);
}
}
// *** Implementation stuff ***
static JSBool SoundGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue)
{
OOSound *sound = nil;
if (!JSVAL_IS_INT(name)) return YES;
if (!JSSoundGetSound(context, this, &sound)) return NO;
switch (JSVAL_TO_INT(name))
{
case kSound_name:
*outValue = [[sound name] javaScriptValueInContext:context];
break;
default:
OOReportJavaScriptBadPropertySelector(context, @"Sound", JSVAL_TO_INT(name));
return NO;
}
return YES;
}
// *** Methods ***
// load(name : String) : Sound
static JSBool SoundStaticLoad(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
NSString *name = nil;
OOSound *sound = nil;
name = JSValToNSString(context, argv[0]);
sound = [ResourceManager ooSoundNamed:name inFolder:@"Sounds"];
*outResult = [sound javaScriptValueInContext:context];
if (*outResult == JSVAL_VOID) *outResult = JSVAL_NULL;
return YES;
}
@implementation OOSound (OOJavaScriptExtentions)
- (jsval) javaScriptValueInContext:(JSContext *)context
{
JSObject *jsSelf = NULL;
jsval result = JSVAL_NULL;
jsSelf = JS_NewObject(context, &sSoundClass.base, sSoundPrototype, NULL);
if (jsSelf != NULL)
{
if (!JS_SetPrivate(context, jsSelf, [self retain])) jsSelf = NULL;
}
if (jsSelf != NULL) result = OBJECT_TO_JSVAL(jsSelf);
return result;
}
- (NSString *) javaScriptDescription
{
return [NSString stringWithFormat:@"[Sound \"%@\"]", [self name]];
}
- (NSString *) jsClassName
{
return @"Sound";
}
@end

View File

@ -0,0 +1,34 @@
/*
OOJSSoundSource.h
JavaScript sound source object.
Oolite
Copyright (C) 2004-2008 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
#import <jsapi.h>
@class OOSoundSource;
void InitOOJSSoundSource(JSContext *context, JSObject *global);
BOOL JSSoundSourceGetSoundSource(JSContext *context, JSObject *soundObj, OOSound **outSound);

View File

@ -0,0 +1,306 @@
/*
OOJSSound.m
Oolite
Copyright (C) 2004-2007 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOJSSound.h"
#import "OOJavaScriptEngine.h"
#import "OOSound.h"
#import "ResourceManager.h"
static JSObject *sSoundSourcePrototype;
static JSBool SoundSourceGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
static JSBool SoundSourceSetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
static JSBool SoundSourceConstruct(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
// Methods
static JSBool SoundSourcePlay(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool SoundSourceStop(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool SoundSourcePlayOrRepeat(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool SoundSourcePlaySound(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSExtendedClass sSoundSourceClass =
{
{
"SoundSource",
JSCLASS_HAS_PRIVATE | JSCLASS_IS_EXTENDED,
JS_PropertyStub, // addProperty
JS_PropertyStub, // delProperty
SoundSourceGetProperty, // getProperty
SoundSourceSetProperty, // setProperty
JS_EnumerateStub, // enumerate
JS_ResolveStub, // resolve
JS_ConvertStub, // convert
JSObjectWrapperFinalize, // finalize
JSCLASS_NO_OPTIONAL_MEMBERS
},
JSObjectWrapperEquality, // equality
NULL, // outerObject
NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS
};
enum
{
// Property IDs
kSoundSource_sound,
kSoundSource_isPlaying,
kSoundSource_loop,
kSoundSource_repeatCount
};
static JSPropertySpec sSoundSourceProperties[] =
{
// JS name ID flags
{ "sound", kSoundSource_sound, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "isPlaying", kSoundSource_isPlaying, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
{ "loop", kSoundSource_loop, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "repeatCount", kSoundSource_repeatCount, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ 0 }
};
static JSFunctionSpec sSoundSourceMethods[] =
{
// JS name Function min args
{ "toString", JSObjectWrapperToString, 0, },
{ "play", SoundSourcePlay, 0, },
{ "stop", SoundSourceStop, 0, },
{ "playOrRepeat", SoundSourcePlayOrRepeat, 0, },
{ "playSound", SoundSourcePlaySound, 1, },
{ 0 }
};
// *** Public ***
void InitOOJSSoundSource(JSContext *context, JSObject *global)
{
sSoundSourcePrototype = JS_InitClass(context, global, NULL, &sSoundSourceClass.base, SoundSourceConstruct, 0, sSoundSourceProperties, sSoundSourceMethods, NULL, NULL);
JSRegisterObjectConverter(&sSoundSourceClass.base, JSBasicPrivateObjectConverter);
}
BOOL JSSoundSourceGetSoundSource(JSContext *context, JSObject *soundSourceObj, OOSoundSource **outSoundSource)
{
if (outSoundSource == NULL) return NO;
*outSoundSource = JSObjectToObjectOfClass(context, soundSourceObj, [OOSoundSource class]);
return *outSoundSource != nil;
}
static JSBool SoundSourceConstruct(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
OOSoundSource *soundSource = nil;
soundSource = [[[OOSoundSource alloc] init] autorelease];
if (soundSource == nil) return NO;
*outResult = [soundSource javaScriptValueInContext:context];
return YES;
}
// *** Implementation stuff ***
static JSBool SoundSourceGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue)
{
OOSoundSource *soundSource = nil;
if (!JSVAL_IS_INT(name)) return YES;
if (!JSSoundSourceGetSoundSource(context, this, &soundSource)) return NO;
switch (JSVAL_TO_INT(name))
{
case kSoundSource_sound:
*outValue = [[soundSource sound] javaScriptValueInContext:context];
break;
case kSoundSource_isPlaying:
*outValue = BOOLToJSVal([soundSource isPlaying]);
break;
case kSoundSource_loop:
*outValue = BOOLToJSVal([soundSource loop]);
break;
case kSoundSource_repeatCount:
*outValue = INT_TO_JSVAL([soundSource repeatCount]);
break;
default:
OOReportJavaScriptBadPropertySelector(context, @"SoundSource", JSVAL_TO_INT(name));
return NO;
}
return YES;
}
static JSBool SoundSourceSetProperty(JSContext *context, JSObject *this, jsval name, jsval *value)
{
OOSoundSource *soundSource = nil;
int32 iValue;
JSBool bValue;
if (!JSVAL_IS_INT(name)) return YES;
if (!JSSoundSourceGetSoundSource(context, this, &soundSource)) return NO;
switch (JSVAL_TO_INT(name))
{
case kSoundSource_sound:
[soundSource setSound:SoundFromJSValue(context, *value)];
break;
case kSoundSource_loop:
if (JS_ValueToBoolean(context, *value, &bValue))
{
[soundSource setLoop:bValue];
}
break;
case kSoundSource_repeatCount:
if (JS_ValueToInt32(context, *value, &iValue) && 0 < iValue)
{
if (iValue > 100) iValue = 100;
if (100 < 1) iValue = 1;
[soundSource setRepeatCount:iValue];
}
break;
default:
OOReportJavaScriptBadPropertySelector(context, @"SoundSource", JSVAL_TO_INT(name));
return NO;
}
return YES;
}
// *** Methods ***
// play([count : Number])
static JSBool SoundSourcePlay(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
OOSoundSource *thisv;
int32 count = 0;
if (!JSSoundSourceGetSoundSource(context, this, &thisv)) return NO;
if (argc > 0)
{
JS_ValueToInt32(context, argv[0], &count);
}
if (count > 0)
{
if (count > 100) count = 100;
[thisv setRepeatCount:count];
}
[thisv play];
return YES;
}
// stop()
static JSBool SoundSourceStop(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
OOSoundSource *thisv;
if (!JSSoundSourceGetSoundSource(context, this, &thisv)) return NO;
[thisv stop];
return YES;
}
// playOrRepeat()
static JSBool SoundSourcePlayOrRepeat(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
OOSoundSource *thisv;
if (!JSSoundSourceGetSoundSource(context, this, &thisv)) return NO;
[thisv playOrRepeat];
return YES;
}
// playSound(sound : SoundExpression [, count : Number])
static JSBool SoundSourcePlaySound(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
OOSoundSource *thisv;
OOSound *sound = nil;
int32 count = 0;
if (!JSSoundSourceGetSoundSource(context, this, &thisv)) return NO;
sound = SoundFromJSValue(context, argv[0]);
if (sound == nil) return YES;
if (argc > 1)
{
JS_ValueToInt32(context, argv[1], &count);
}
[thisv setSound:sound];
if (count > 0)
{
if (count > 100) count = 100;
[thisv setRepeatCount:count];
}
[thisv play];
return YES;
}
@implementation OOSoundSource (OOJavaScriptExtentions)
- (jsval) javaScriptValueInContext:(JSContext *)context
{
JSObject *jsSelf = NULL;
jsval result = JSVAL_NULL;
jsSelf = JS_NewObject(context, &sSoundSourceClass.base, sSoundSourcePrototype, NULL);
if (jsSelf != NULL)
{
if (!JS_SetPrivate(context, jsSelf, [self retain])) jsSelf = NULL;
}
if (jsSelf != NULL) result = OBJECT_TO_JSVAL(jsSelf);
return result;
}
- (NSString *) jsClassName
{
return @"SoundSource";
}
@end

View File

@ -54,7 +54,7 @@ static JSExtendedClass sStationClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS

View File

@ -54,7 +54,7 @@ static JSExtendedClass sSunClass =
JSObjectWrapperFinalize,// finalize JSObjectWrapperFinalize,// finalize
JSCLASS_NO_OPTIONAL_MEMBERS JSCLASS_NO_OPTIONAL_MEMBERS
}, },
JSEntityEquality, // equality JSObjectWrapperEquality, // equality
NULL, // outerObject NULL, // outerObject
NULL, // innerObject NULL, // innerObject
JSCLASS_NO_RESERVED_MEMBERS JSCLASS_NO_RESERVED_MEMBERS

View File

@ -151,11 +151,19 @@ JSBool JSObjectWrapperToString(JSContext *context, JSObject *this, uintN argc, j
/* JSObjectWrapperFinalize /* JSObjectWrapperFinalize
Finalizer for JS classes whose private storage is a retained object Finalizer for JS classes whose private storage is a retained object
reference (generally an OOWeakReference). reference (generally an OOWeakReference, but doesn't have to be).
*/ */
void JSObjectWrapperFinalize(JSContext *context, JSObject *this); void JSObjectWrapperFinalize(JSContext *context, JSObject *this);
/* JSObjectWrapperEquality
Comparator for JS classes whose private storage is a retained object;
wraps isEqual.
*/
JSBool JSObjectWrapperEquality(JSContext *context, JSObject *this, jsval value, JSBool *outEqual);
@interface NSString (OOJavaScriptExtensions) @interface NSString (OOJavaScriptExtensions)
// Convert a JSString to an NSString. // Convert a JSString to an NSString.
@ -203,6 +211,8 @@ BOOL JSEntityIsJavaScriptSearchablePredicate(Entity *entity, void *parameter);
id JSValueToObject(JSContext *context, jsval value); id JSValueToObject(JSContext *context, jsval value);
id JSObjectToObject(JSContext *context, JSObject *object); id JSObjectToObject(JSContext *context, JSObject *object);
id JSValueToObjectOfClass(JSContext *context, jsval value, Class requiredClass);
id JSObjectToObjectOfClass(JSContext *context, JSObject *object, Class requiredClass);
/* Support for JSValueToObject() /* Support for JSValueToObject()

View File

@ -41,6 +41,8 @@ MA 02110-1301, USA.
#import "OOJSClock.h" #import "OOJSClock.h"
#import "OOJSSun.h" #import "OOJSSun.h"
#import "OOJSWorldScripts.h" #import "OOJSWorldScripts.h"
#import "OOJSSound.h"
#import "OOJSSoundSource.h"
#import "OOCollectionExtractors.h" #import "OOCollectionExtractors.h"
#import "Universe.h" #import "Universe.h"
@ -218,6 +220,8 @@ static void ReportJSError(JSContext *context, const char *message, JSErrorReport
InitOOJSTimer(mainContext, globalObject); InitOOJSTimer(mainContext, globalObject);
InitOOJSClock(mainContext, globalObject); InitOOJSClock(mainContext, globalObject);
InitOOJSWorldScripts(mainContext, globalObject); InitOOJSWorldScripts(mainContext, globalObject);
InitOOJSSound(mainContext, globalObject);
InitOOJSSoundSource(mainContext, globalObject);
OOLog(@"script.javaScript.init.success", @"Set up JavaScript context."); OOLog(@"script.javaScript.init.success", @"Set up JavaScript context.");
@ -1053,6 +1057,18 @@ void JSObjectWrapperFinalize(JSContext *context, JSObject *this)
} }
JSBool JSObjectWrapperEquality(JSContext *context, JSObject *this, jsval value, JSBool *outEqual)
{
id thisObj, thatObj;
thisObj = JSObjectToObject(context, this);
thatObj = JSValueToObject(context, value);
*outEqual = [thisObj isEqual:thatObj];
return YES;
}
BOOL JSFunctionPredicate(Entity *entity, void *parameter) BOOL JSFunctionPredicate(Entity *entity, void *parameter)
{ {
JSFunctionPredicateParameter *param = parameter; JSFunctionPredicateParameter *param = parameter;
@ -1161,6 +1177,22 @@ id JSObjectToObject(JSContext *context, JSObject *object)
} }
id JSValueToObjectOfClass(JSContext *context, jsval value, Class requiredClass)
{
id result = JSValueToObject(context, value);
if (![result isKindOfClass:requiredClass]) result = nil;
return result;
}
id JSObjectToObjectOfClass(JSContext *context, JSObject *object, Class requiredClass)
{
id result = JSObjectToObject(context, object);
if (![result isKindOfClass:requiredClass]) result = nil;
return result;
}
id JSBasicPrivateObjectConverter(JSContext *context, JSObject *object) id JSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
{ {
id result; id result;