View Issue Details

IDProjectCategoryView StatusLast Update
0002668FSSCPscriptingpublic2012-06-25 06:22
Reporterz64555 Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionwon't fix 
Platformx86_32OSWindows XPOS VersionSP3
Product Version3.6.14 RC6 
Summary0002668: getSoundEntry missing from RC6
DescriptionOne of our LUA scripts for FringeSpace uses getSoundEntry, upon running the mod, the LUA error occurs every time the main hall mission (attached) loads.
Steps To ReproduceDownload the attached mission file
Run a Debug build of 3.6.14 RC6
Open the mission file, and observe if any LUA errors arise
TagsNo tags attached.

Activities

z64555

2012-06-19 05:31

developer  

FSMenuMap.fs2 (4,101 bytes)

CommanderDJ

2012-06-19 06:38

developer  

mantis_2668.patch (1,608 bytes)   
Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp	(revision 8898)
+++ code/parse/lua.cpp	(working copy)
@@ -9013,6 +9013,40 @@
 //**********LIBRARY: Audio
 ade_lib l_Audio("Audio", NULL, "ad", "Sound/Music Library");
 
+ADE_FUNC(getSoundentry, l_Audio, "string/number", "Return a sound entry matching the specified index or name. If you are using a number then the first valid index is 1", "soundentry", "soundentry or invalid handle on error")
+{
+	int index = -1;
+
+	if (lua_isnumber(L, 1))
+	{
+		int idx = -1;
+		if(!ade_get_args(L, "i", &idx))
+			return ade_set_error(L, "o", l_SoundEntry.Set(sound_entry_h()));
+		
+		index = gamesnd_get_by_tbl_index(idx);
+	}
+	else
+	{
+		char *s = NULL;
+		if(!ade_get_args(L, "s", &s))
+			return ade_set_error(L, "o", l_SoundEntry.Set(sound_entry_h()));
+
+		if (s == NULL)
+			return ade_set_error(L, "o", l_SoundEntry.Set(sound_entry_h()));
+
+		index = gamesnd_get_by_name(s);
+	}
+
+	if (index < 0)
+	{
+		return ade_set_args(L, "o", l_SoundEntry.Set(sound_entry_h()));
+	}
+	else
+	{
+		return ade_set_args(L, "o", l_SoundEntry.Set(sound_entry_h(0, index)));
+	}
+}
+
 ADE_FUNC(playGameSound, l_Audio, "Sound index, [Panning (-1.0 left to 1.0 right), Volume %, Priority 0-3, Voice Message?]", "Plays a sound from #Game Sounds in sounds.tbl. A priority of 0 indicates that the song must play; 1-3 will specify the maximum number of that sound that can be played", "boolean", "True if sound was played, false if not (Replaced with a sound instance object in the future)")
 {
 	int idx;
mantis_2668.patch (1,608 bytes)   

CommanderDJ

2012-06-19 06:38

developer   ~0013677

Possible fix attached: I simply copied the getSoundentry function over from lua.cpp in trunk.

m_m

2012-06-19 08:08

developer   ~0013678

I doubt that that will actually work as the whole new sound API isn't present in the 3.6.14 branch. The solution would be to either copy the new sound API or just use a trunk build if compatibility with 3.6.14 isn't needed.

CommanderDJ

2012-06-20 04:08

developer   ~0013682

If I may ask, why isn't the new sound API in .14?

m_m

2012-06-20 07:43

developer   ~0013683

Probably because it's a feature that got added after the 3.6.14 branch was created and was placed under a feature freeze.

Echelon9

2012-06-20 15:25

developer   ~0013684

This is a post 3.6.14 feature, as we are in feature freeze this is very unlikely to be back ported.

Nightly builds and the typical build process will kick off again once 3.6.14 in final and released.

Issue History

Date Modified Username Field Change
2012-06-19 05:31 z64555 New Issue
2012-06-19 05:31 z64555 File Added: FSMenuMap.fs2
2012-06-19 06:38 CommanderDJ File Added: mantis_2668.patch
2012-06-19 06:38 CommanderDJ Note Added: 0013677
2012-06-19 08:08 m_m Note Added: 0013678
2012-06-20 04:08 CommanderDJ Note Added: 0013682
2012-06-20 07:43 m_m Note Added: 0013683
2012-06-20 15:25 Echelon9 Note Added: 0013684
2012-06-20 15:25 Echelon9 Status new => closed
2012-06-20 15:25 Echelon9 Resolution open => won't fix
2012-06-25 06:22 Goober5000 Product Version 3.6.14 RC5 => 3.6.14 RC6
2012-06-25 06:22 Goober5000 Additional Information Updated