1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 04:57:18 +00:00

cleaned up paths for MUSIC, SOUND, and other

This commit is contained in:
Zeno Rogue 2024-07-10 00:05:30 +02:00
parent 6bbd57ecbe
commit cc3863d1fe
3 changed files with 8 additions and 24 deletions

View File

@ -197,16 +197,10 @@ EX bool loadMusicInfo(string dir) {
EX bool loadMusicInfo() {
return
loadMusicInfo(musicfile)
|| loadMusicInfo(HYPERPATH "hyperrogue-music.txt")
|| loadMusicInfo("./hyperrogue-music.txt")
|| loadMusicInfo("music/hyperrogue-music.txt")
// Destination set by ./configure (in the GitHub repository)
#ifdef MUSICDESTDIR
|| loadMusicInfo(MUSICDESTDIR)
#endif
loadMusicInfo(find_file(musicfile))
|| loadMusicInfo(find_file("hyperrogue-music.txt") )
|| loadMusicInfo(find_file("music/hyperrogue-music.txt") )
#ifdef FHS
|| loadMusicInfo("/usr/share/hyperrogue/hyperrogue-music.txt")
|| (getenv("HOME") && loadMusicInfo(s0 + getenv("HOME") + "/.hyperrogue-music.txt"))
#endif
;
@ -229,21 +223,17 @@ EX void initAudio() {
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;
EX string wheresounds = "sounds/";
EX void playSound(cell *c, const string& fname, int vol) {
LATE( hr::playSound(c, fname, vol); )
if(effvolume == 0) return;
if(callhandlers(false, hooks_sound, fname, vol)) return;
// printf("Play sound: %s\n", fname.c_str());
if(!chunks.count(fname)) {
string s = wheresounds+fname+".ogg";
string s = find_file(wheresounds + fname + ".ogg");
if(memory_issues()) return;
memory_for_lib();
chunks[fname] = Mix_LoadWAV(s.c_str());

View File

@ -346,14 +346,6 @@
#undef XEXTRALICENSE
#endif
#ifndef HYPERPATH
#define HYPERPATH ""
#endif
#ifndef HYPERFONTPATH
#define HYPERFONTPATH HYPERPATH
#endif
#if ISWINDOWS
#define hyper fake_hyper // avoid "hyper" typedef in <_mingw.h>
#define WIN32_LEAN_AND_MEAN // avoid "rad1" macro in <windows.h>

View File

@ -975,7 +975,9 @@ EX string find_file(string s) {
if(file_exists(s)) return s;
char *p = getenv("HYPERPATH");
if(p && file_exists(s1 = s0 + p + s)) return s1;
#ifdef HYPERPATH
if(file_exists(s1 = HYPERPATH + s)) return s1;
#endif
#ifdef FHS
if(file_exists(s1 = "/usr/share/hyperrogue/" + s)) return s1;
#endif