mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 06:27:17 +00:00
cleaned up paths for MUSIC, SOUND, and other
This commit is contained in:
parent
6bbd57ecbe
commit
cc3863d1fe
22
sound.cpp
22
sound.cpp
@ -197,16 +197,10 @@ EX bool loadMusicInfo(string dir) {
|
|||||||
|
|
||||||
EX bool loadMusicInfo() {
|
EX bool loadMusicInfo() {
|
||||||
return
|
return
|
||||||
loadMusicInfo(musicfile)
|
loadMusicInfo(find_file(musicfile))
|
||||||
|| loadMusicInfo(HYPERPATH "hyperrogue-music.txt")
|
|| loadMusicInfo(find_file("hyperrogue-music.txt") )
|
||||||
|| loadMusicInfo("./hyperrogue-music.txt")
|
|| loadMusicInfo(find_file("music/hyperrogue-music.txt") )
|
||||||
|| loadMusicInfo("music/hyperrogue-music.txt")
|
|
||||||
// Destination set by ./configure (in the GitHub repository)
|
|
||||||
#ifdef MUSICDESTDIR
|
|
||||||
|| loadMusicInfo(MUSICDESTDIR)
|
|
||||||
#endif
|
|
||||||
#ifdef FHS
|
#ifdef FHS
|
||||||
|| loadMusicInfo("/usr/share/hyperrogue/hyperrogue-music.txt")
|
|
||||||
|| (getenv("HOME") && loadMusicInfo(s0 + getenv("HOME") + "/.hyperrogue-music.txt"))
|
|| (getenv("HOME") && loadMusicInfo(s0 + getenv("HOME") + "/.hyperrogue-music.txt"))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@ -229,21 +223,17 @@ EX void initAudio() {
|
|||||||
|
|
||||||
map<string, Mix_Chunk*> chunks;
|
map<string, Mix_Chunk*> chunks;
|
||||||
|
|
||||||
#ifdef SOUNDDESTDIR
|
|
||||||
string wheresounds = SOUNDDESTDIR;
|
|
||||||
#else
|
|
||||||
string wheresounds = HYPERPATH "sounds/";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hookset<bool(const string& s, int vol)> hooks_sound;
|
hookset<bool(const string& s, int vol)> hooks_sound;
|
||||||
|
|
||||||
|
EX string wheresounds = "sounds/";
|
||||||
|
|
||||||
EX void playSound(cell *c, const string& fname, int vol) {
|
EX void playSound(cell *c, const string& fname, int vol) {
|
||||||
LATE( hr::playSound(c, fname, vol); )
|
LATE( hr::playSound(c, fname, vol); )
|
||||||
if(effvolume == 0) return;
|
if(effvolume == 0) return;
|
||||||
if(callhandlers(false, hooks_sound, fname, vol)) return;
|
if(callhandlers(false, hooks_sound, fname, vol)) return;
|
||||||
// printf("Play sound: %s\n", fname.c_str());
|
// printf("Play sound: %s\n", fname.c_str());
|
||||||
if(!chunks.count(fname)) {
|
if(!chunks.count(fname)) {
|
||||||
string s = wheresounds+fname+".ogg";
|
string s = find_file(wheresounds + fname + ".ogg");
|
||||||
if(memory_issues()) return;
|
if(memory_issues()) return;
|
||||||
memory_for_lib();
|
memory_for_lib();
|
||||||
chunks[fname] = Mix_LoadWAV(s.c_str());
|
chunks[fname] = Mix_LoadWAV(s.c_str());
|
||||||
|
@ -346,14 +346,6 @@
|
|||||||
#undef XEXTRALICENSE
|
#undef XEXTRALICENSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HYPERPATH
|
|
||||||
#define HYPERPATH ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HYPERFONTPATH
|
|
||||||
#define HYPERFONTPATH HYPERPATH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ISWINDOWS
|
#if ISWINDOWS
|
||||||
#define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h>
|
#define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h>
|
||||||
#define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h>
|
#define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h>
|
||||||
|
2
util.cpp
2
util.cpp
@ -975,7 +975,9 @@ EX string find_file(string s) {
|
|||||||
if(file_exists(s)) return s;
|
if(file_exists(s)) return s;
|
||||||
char *p = getenv("HYPERPATH");
|
char *p = getenv("HYPERPATH");
|
||||||
if(p && file_exists(s1 = s0 + p + s)) return s1;
|
if(p && file_exists(s1 = s0 + p + s)) return s1;
|
||||||
|
#ifdef HYPERPATH
|
||||||
if(file_exists(s1 = HYPERPATH + s)) return s1;
|
if(file_exists(s1 = HYPERPATH + s)) return s1;
|
||||||
|
#endif
|
||||||
#ifdef FHS
|
#ifdef FHS
|
||||||
if(file_exists(s1 = "/usr/share/hyperrogue/" + s)) return s1;
|
if(file_exists(s1 = "/usr/share/hyperrogue/" + s)) return s1;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user