178{
180
181 double fValue;
182 int32_t iValue;
183 NSString* sValue =
nil;
185
186 switch (magic) {
188 if (JS_ToFloat64(context, &fValue, value) == 0) {
191 return JS_UNDEFINED;
192 }
193 break;
194
197 iValue =
MAX(iValue, 0);
198 [UNIVERSE setCurrentPostFX:iValue];
199 return JS_UNDEFINED;
200 }
201 break;
202
204 if (!JS_IsString(value))
205 break;
208#if OOLITE_WINDOWS
209 if ([gameView hdrOutput])
210 [gameView setHDRToneMapper:OOHDRToneMapperFromString(sValue)];
211 else
212 OOJSReportWarning(context,
@"hdrToneMapper cannot be set if not running in HDR mode");
213#endif
214 return JS_UNDEFINED;
215 }
216 break;
217
219 if (!JS_IsString(value))
220 break;
223 if (![gameView hdrOutput])
225 else
226 OOJSReportWarning(context,
@"sdrToneMapper cannot be set if not running in SDR mode");
227 return JS_UNDEFINED;
228 }
229 break;
230
231#ifdef OO_DEBUG_MONITOR_ENABLED
232 case kOolite_timeAccelerationFactor:
233 if (JS_ToFloat64(context, &fValue, value) == 0) {
234 [UNIVERSE setTimeAccelerationFactor:fValue];
235 return JS_UNDEFINED;
236 }
237 break;
238#endif
239
240 default:
242 return JS_EXCEPTION;
243 }
244
245
246 if (JS_HasException(context))
247 JS_FreeValue(context, JS_GetException(context));
249 return JS_EXCEPTION;
250
252}
void OOJSReportWarning(JSContext *context, NSString *format,...)
OOINLINE BOOL OOJSValueToInt32(JSContext *context, jsval value, int32_t *outValue)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
void adjustColorSaturation:(float colorSaturationAdjustment)
void setSDRToneMapper:(OOSDRToneMapper newToneMapper)