hyperrogue/devmods/musictable.cpp

40 lines
1.1 KiB
C++
Raw Permalink Normal View History

2021-05-31 13:53:35 +00:00
#include "../hyper.h"
// a tool to generate the music tables for Android and iOS
namespace hr {
2022-07-12 08:57:07 +00:00
string crop(string s) {
string res;
for(char c: s) if(c == '-') res = ""; else res += c;
return res;
}
string cropios(string s) {
string res;
for(char c: s) if(c == '.') return res; else res += c;
return res;
}
2021-05-31 13:53:35 +00:00
auto aec =
arg::add3("-music-ios", [] {
for(int i=0; i<landtypes; i++)
if(musfname[i] == "") printf(" NULL,\n");
2022-07-12 08:57:07 +00:00
else printf(" @\"%s\", // %2d : %s\n", cropios(musfname[i]).c_str(), i, dnameof(eLand(i)).c_str());
2021-05-31 13:53:35 +00:00
})
+ arg::add3("-music-android", [] {
for(int i=0; i<landtypes; i++)
if(musfname[i] != "") {
string s = musfname[i].substr(4, isize(musfname[i])-8);
2022-07-12 08:57:07 +00:00
printf(" if(curland == %2d) id = R.raw.%s; // %s\n", i, crop(s).c_str(), dnameof(eLand(i)).c_str());
2021-05-31 13:53:35 +00:00
}
})
+ arg::add3("-music-license", [] {
printf("musiclicense = \"");
for(int i=0; i<isize(musiclicense); i++)
if(musiclicense[i] == '\n') printf("\\n\"\n\""); else printf("%c", musiclicense[i]);
printf("\";\n");
});
}