Trunk Sync r7529

This commit is contained in:
Zacam committed 2011-08-24 20:41:13 +00:00
1 parent 971ae63ea3
commit 2f6d659147
11 files changed
+487 -128

No files matched your search

+7 -4
View File
@@ -4788,7 +4788,7 @@ ADE_FUNC(getrvec, l_Object, "[boolean normalize]", "Returns the objects' current
return ADE_RETURN_NIL;
obj = objh->objp;
vec3d v1 = obj->orient.vec.fvec;
vec3d v1 = obj->orient.vec.rvec;
if (normalize)
vm_vec_normalize(&v1);
@@ -9433,17 +9433,20 @@ public:
ade_obj<track_h> l_Track("track", "Music track");
*/
ADE_FUNC(playMusic, l_Audio, "string Filename", "Plays a music file using FS2Open's builtin music system", "number", "Audiohandle of the created audiostream, or -1 on failure")
ADE_FUNC(playMusic, l_Audio, "string Filename, [float volume = 1.0]", "Plays a music file using FS2Open's builtin music system. Volume should be in the 0.0 - 1.0 range, and is capped at 1.0.", "number", "Audiohandle of the created audiostream, or -1 on failure")
{
char *s;
if(!ade_get_args(L, "s", &s))
float volume = 1.0f;
if(!ade_get_args(L, "s|f", &s, &volume))
return ade_set_error(L, "i", -1);
int ah = audiostream_open(s, ASF_MENUMUSIC);
if(ah < 0)
return ade_set_error(L, "i", -1);
audiostream_play(ah);
CLAMP(volume, 0.0f, 1.0f);
audiostream_play(ah, volume);
return ade_set_args(L, "i", ah);
}