mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:15:38 +00:00
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
|
||||
else
|
||||
{
|
||||
writefln("Lookup failed to find sound %s", id);
|
||||
//writefln("Lookup failed to find sound %s", id);
|
||||
si.file = null;
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ struct ResourceManager
|
|||
|
||||
if(mi.bsaIndex == -1)
|
||||
{
|
||||
writefln("Lookup failed to find mesh %s", search);
|
||||
//writefln("Lookup failed to find mesh %s", search);
|
||||
assert(mi.bsaFile == -1);
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ struct ResourceManager
|
|||
|
||||
if(ti.bsaIndex == -1)
|
||||
{
|
||||
writefln("Lookup failed to find texture %s", tmp);
|
||||
//writefln("Lookup failed to find texture %s", tmp);
|
||||
assert(ti.bsaFile == -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -200,9 +200,11 @@ extern "C" void cpp_makeScene()
|
|||
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()
|
||||
{
|
||||
mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 );
|
||||
//mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 );
|
||||
}
|
||||
|
||||
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
|
||||
startRendering();
|
||||
|
||||
jukebox.disableMusic();
|
||||
battleMusic.disableMusic();
|
||||
}
|
||||
else debug(verbose) writefln("Skipping rendering");
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ public import sound.music;
|
|||
import sound.al;
|
||||
import sound.alc;
|
||||
|
||||
import std.stdio;
|
||||
import std.string;
|
||||
|
||||
ALCdevice *Device = null;
|
||||
ALCcontext *Context = null;
|
||||
|
||||
|
@ -67,7 +70,11 @@ void initializeSound()
|
|||
|
||||
void shutdownSound()
|
||||
{
|
||||
jukebox.disableMusic();
|
||||
battleMusic.disableMusic();
|
||||
|
||||
alutExit();
|
||||
|
||||
alcMakeContextCurrent(null);
|
||||
if(Context) alcDestroyContext(Context);
|
||||
Context = null;
|
||||
|
|
|
@ -26,6 +26,7 @@ module sound.music;
|
|||
import sound.audio;
|
||||
import sound.al;
|
||||
|
||||
import std.stdio;
|
||||
import std.string;
|
||||
|
||||
import core.config;
|
||||
|
@ -54,6 +55,7 @@ struct MusicManager
|
|||
throw new SoundException(name ~ " Jukebox", msg);
|
||||
}
|
||||
|
||||
/* KILLME
|
||||
// Used when randomizing playlist
|
||||
struct rndListStruct
|
||||
{
|
||||
|
@ -61,6 +63,7 @@ struct MusicManager
|
|||
bool used;
|
||||
}
|
||||
rndListStruct[] rndList;
|
||||
*/
|
||||
|
||||
// TODO: How do we handle the play list? Randomize should be an
|
||||
// option. We could also support things like M3U files, etc.
|
||||
|
@ -112,17 +115,33 @@ struct MusicManager
|
|||
randomize();
|
||||
}
|
||||
|
||||
// Randomize playlist. An N^2 algorithm, but our current playlists
|
||||
// are small. Improve it later if you really have to. If the
|
||||
// argument is true, then we don't want the old last to be the new
|
||||
// first.
|
||||
// Randomize playlist. If the argument is true, then we don't want
|
||||
// the old last to be the new first.
|
||||
private void randomize(bool checklast = false)
|
||||
{
|
||||
if(playlist.length < 2) return;
|
||||
|
||||
// Get the name of the last song played
|
||||
char[] last = playlist[(index==0) ? ($-1) : (index-1)];
|
||||
// Get the index of the last song played
|
||||
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;
|
||||
rndList.length = left;
|
||||
|
||||
|
@ -159,7 +178,7 @@ struct MusicManager
|
|||
playlist[0] = playlist[$-1];
|
||||
playlist[$-1] = last;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Skip to the next track
|
||||
void playNext()
|
||||
|
|
Loading…
Reference in a new issue