forked from mirror/openmw-tes3mp
Updated music randomizer, disabled skydome, minor fixes
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@21 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
6988814728
commit
d3666aac17
5 changed files with 39 additions and 14 deletions
|
@ -183,7 +183,7 @@ struct ResourceManager
|
||||||
// Otherwise, make this an empty resource
|
// Otherwise, make this an empty resource
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writefln("Lookup failed to find sound %s", id);
|
//writefln("Lookup failed to find sound %s", id);
|
||||||
si.file = null;
|
si.file = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ struct ResourceManager
|
||||||
|
|
||||||
if(mi.bsaIndex == -1)
|
if(mi.bsaIndex == -1)
|
||||||
{
|
{
|
||||||
writefln("Lookup failed to find mesh %s", search);
|
//writefln("Lookup failed to find mesh %s", search);
|
||||||
assert(mi.bsaFile == -1);
|
assert(mi.bsaFile == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ struct ResourceManager
|
||||||
|
|
||||||
if(ti.bsaIndex == -1)
|
if(ti.bsaIndex == -1)
|
||||||
{
|
{
|
||||||
writefln("Lookup failed to find texture %s", tmp);
|
//writefln("Lookup failed to find texture %s", tmp);
|
||||||
assert(ti.bsaFile == -1);
|
assert(ti.bsaFile == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,9 +200,11 @@ extern "C" void cpp_makeScene()
|
||||||
root->pitch(Degree(-90));
|
root->pitch(Degree(-90));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a sky dome. Currently disabled since we aren't including the
|
||||||
|
// Ogre example data (which has the sky material.)
|
||||||
extern "C" void cpp_makeSky()
|
extern "C" void cpp_makeSky()
|
||||||
{
|
{
|
||||||
mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 );
|
//mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" Light* cpp_attachLight(char *name, SceneNode* base,
|
extern "C" Light* cpp_attachLight(char *name, SceneNode* base,
|
||||||
|
|
3
openmw.d
3
openmw.d
|
@ -359,9 +359,6 @@ void main(char[][] args)
|
||||||
|
|
||||||
// Run it until the user tells us to quit
|
// Run it until the user tells us to quit
|
||||||
startRendering();
|
startRendering();
|
||||||
|
|
||||||
jukebox.disableMusic();
|
|
||||||
battleMusic.disableMusic();
|
|
||||||
}
|
}
|
||||||
else debug(verbose) writefln("Skipping rendering");
|
else debug(verbose) writefln("Skipping rendering");
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ public import sound.music;
|
||||||
import sound.al;
|
import sound.al;
|
||||||
import sound.alc;
|
import sound.alc;
|
||||||
|
|
||||||
|
import std.stdio;
|
||||||
|
import std.string;
|
||||||
|
|
||||||
ALCdevice *Device = null;
|
ALCdevice *Device = null;
|
||||||
ALCcontext *Context = null;
|
ALCcontext *Context = null;
|
||||||
|
|
||||||
|
@ -67,7 +70,11 @@ void initializeSound()
|
||||||
|
|
||||||
void shutdownSound()
|
void shutdownSound()
|
||||||
{
|
{
|
||||||
|
jukebox.disableMusic();
|
||||||
|
battleMusic.disableMusic();
|
||||||
|
|
||||||
alutExit();
|
alutExit();
|
||||||
|
|
||||||
alcMakeContextCurrent(null);
|
alcMakeContextCurrent(null);
|
||||||
if(Context) alcDestroyContext(Context);
|
if(Context) alcDestroyContext(Context);
|
||||||
Context = null;
|
Context = null;
|
||||||
|
|
|
@ -26,6 +26,7 @@ module sound.music;
|
||||||
import sound.audio;
|
import sound.audio;
|
||||||
import sound.al;
|
import sound.al;
|
||||||
|
|
||||||
|
import std.stdio;
|
||||||
import std.string;
|
import std.string;
|
||||||
|
|
||||||
import core.config;
|
import core.config;
|
||||||
|
@ -54,6 +55,7 @@ struct MusicManager
|
||||||
throw new SoundException(name ~ " Jukebox", msg);
|
throw new SoundException(name ~ " Jukebox", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* KILLME
|
||||||
// Used when randomizing playlist
|
// Used when randomizing playlist
|
||||||
struct rndListStruct
|
struct rndListStruct
|
||||||
{
|
{
|
||||||
|
@ -61,6 +63,7 @@ struct MusicManager
|
||||||
bool used;
|
bool used;
|
||||||
}
|
}
|
||||||
rndListStruct[] rndList;
|
rndListStruct[] rndList;
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO: How do we handle the play list? Randomize should be an
|
// TODO: How do we handle the play list? Randomize should be an
|
||||||
// option. We could also support things like M3U files, etc.
|
// option. We could also support things like M3U files, etc.
|
||||||
|
@ -112,17 +115,33 @@ struct MusicManager
|
||||||
randomize();
|
randomize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Randomize playlist. An N^2 algorithm, but our current playlists
|
// Randomize playlist. If the argument is true, then we don't want
|
||||||
// are small. Improve it later if you really have to. If the
|
// the old last to be the new first.
|
||||||
// argument is true, then we don't want the old last to be the new
|
|
||||||
// first.
|
|
||||||
private void randomize(bool checklast = false)
|
private void randomize(bool checklast = false)
|
||||||
{
|
{
|
||||||
if(playlist.length < 2) return;
|
if(playlist.length < 2) return;
|
||||||
|
|
||||||
// Get the name of the last song played
|
// Get the index of the last song played
|
||||||
char[] last = playlist[(index==0) ? ($-1) : (index-1)];
|
int lastidx = ((index==0) ? (playlist.length-1) : (index-1));
|
||||||
|
|
||||||
|
foreach(int i, char[] s; playlist)
|
||||||
|
{
|
||||||
|
int idx = rnd.randInt(i,playlist.length-1);
|
||||||
|
|
||||||
|
// Don't put the last idx as the first entry
|
||||||
|
if(i == 0 && checklast && lastidx == idx)
|
||||||
|
{
|
||||||
|
idx++;
|
||||||
|
if(idx == playlist.length)
|
||||||
|
idx = i;
|
||||||
|
}
|
||||||
|
if(idx == i) /* skip if swapping with self */
|
||||||
|
continue;
|
||||||
|
playlist[i] = playlist[idx];
|
||||||
|
playlist[idx] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* KILLME
|
||||||
int left = playlist.length;
|
int left = playlist.length;
|
||||||
rndList.length = left;
|
rndList.length = left;
|
||||||
|
|
||||||
|
@ -159,7 +178,7 @@ struct MusicManager
|
||||||
playlist[0] = playlist[$-1];
|
playlist[0] = playlist[$-1];
|
||||||
playlist[$-1] = last;
|
playlist[$-1] = last;
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
|
|
||||||
// Skip to the next track
|
// Skip to the next track
|
||||||
void playNext()
|
void playNext()
|
||||||
|
|
Loading…
Reference in a new issue