mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 06:05:15 -04:00
jak3: more rpc fixes (#4166)
This commit is contained in:
Vendored
+3
-2
@@ -61,11 +61,12 @@ void set_discord_rpc(int state) {
|
||||
}
|
||||
|
||||
// get base level name from sublevel ("wascitya" -> "wascity")
|
||||
const char* get_base_level_name(const std::map<std::string, std::string>& level_name_remap,
|
||||
std::string get_base_level_name(const std::map<std::string, std::string>& level_name_remap,
|
||||
const char* level_name) {
|
||||
// ignore sublevels
|
||||
auto it = level_name_remap.find(level_name);
|
||||
return (it == level_name_remap.end() ? level_name : it->second).c_str();
|
||||
const auto base_name = it == level_name_remap.end() ? level_name : it->second;
|
||||
return base_name;
|
||||
}
|
||||
|
||||
// get full level name from symbol name ("village1" -> "Sandover Village")
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ std::string get_time_of_day(float time);
|
||||
const char* get_full_level_name(const std::map<std::string, std::string>& level_names,
|
||||
const std::map<std::string, std::string>& level_name_remap,
|
||||
const char* level_name);
|
||||
const char* get_base_level_name(const std::map<std::string, std::string>& level_name_remap,
|
||||
std::string get_base_level_name(const std::map<std::string, std::string>& level_name_remap,
|
||||
const char* level_name);
|
||||
bool indoors(std::vector<std::string> indoor_levels, const char* level_name);
|
||||
|
||||
|
||||
Vendored
+5
-5
@@ -35,15 +35,15 @@ const std::map<std::string, std::string> level_names = {
|
||||
|
||||
// for remapping sub-level names to the matching one in level_names
|
||||
std::map<std::string, std::string> level_name_remap = {
|
||||
{"introcst", "intro"}, {"templex", "temple"}, {"combx", "comb"}, {"volcanox", "volcano"},
|
||||
{"volcanoa", "volcano"}, {"railx", "rail"}, {"railb2", "rail"}, {"rubblea2", "rubble"},
|
||||
{"wasstada", "wasstad"}, {"lfacrm2", "factory"},
|
||||
{"introcst", "intro"}, {"templex", "temple"}, {"combm", "comb"}, {"combn", "comb"},
|
||||
{"combx", "comb"}, {"volcanox", "volcano"}, {"volcanoa", "volcano"}, {"railx", "rail"},
|
||||
{"railb2", "rail"}, {"rubblea2", "rubble"}, {"wasstada", "wasstad"}, {"lfacrm2", "factory"},
|
||||
};
|
||||
|
||||
const std::map<std::string, std::pair<char, char>> level_remap_hack = {
|
||||
{"forest", {'a', 'b'}}, {"factory", {'a', 'd'}}, {"stadium", {'a', 'b'}},
|
||||
{"hang", {'a', 'b'}}, {"wascity", {'a', 'b'}}, {"nst", {'a', 'b'}},
|
||||
{"mhcity", {'a', 'b'}}, {"sew", {'a', 'o'}}, {"comb", {'a', 'n'}},
|
||||
{"mhcity", {'a', 'b'}}, {"sew", {'a', 'o'}}, {"comb", {'a', 'e'}},
|
||||
{"rail", {'a', 'e'}}, {"desert", {'a', 'h'}}, {"temple", {'a', 'd'}},
|
||||
{"ctygen", {'a', 'c'}}, {"ctyind", {'a', 'b'}}, {"ctyslum", {'a', 'c'}},
|
||||
{"mine", {'a', 'e'}}, {"rubble", {'a', 'c'}}, {"precur", {'a', 'd'}},
|
||||
@@ -54,7 +54,7 @@ void remap_hack() {
|
||||
auto base_name = name.first;
|
||||
auto suffix_start = name.second.first;
|
||||
auto suffix_end = name.second.second;
|
||||
for (int i = 0; i < suffix_end - suffix_start; i++) {
|
||||
for (int i = 0; i <= suffix_end - suffix_start; i++) {
|
||||
auto suffix = static_cast<char>(suffix_start + i);
|
||||
std::string level(base_name);
|
||||
level.push_back(suffix);
|
||||
|
||||
@@ -58,15 +58,16 @@ void update_discord_rpc(u32 discord_info) {
|
||||
if (strcmp(task, "unknown") != 0) {
|
||||
strcpy(large_image_key, task);
|
||||
} else {
|
||||
auto base_level_name = get_base_level_name(level_name_remap, level);
|
||||
// if we are in an outdoors level, use the picture for the corresponding time of day
|
||||
if (!indoors(indoor_levels, level)) {
|
||||
if (!indoors(indoor_levels, base_level_name.c_str())) {
|
||||
char level_with_tod[128] = {};
|
||||
strcpy(level_with_tod, get_base_level_name(level_name_remap, level));
|
||||
strcpy(level_with_tod, base_level_name.c_str());
|
||||
strcat(level_with_tod, "-");
|
||||
strcat(level_with_tod, time_of_day_str(time));
|
||||
strcpy(large_image_key, level_with_tod);
|
||||
} else {
|
||||
strcpy(large_image_key, level);
|
||||
strcpy(large_image_key, base_level_name.c_str());
|
||||
}
|
||||
}
|
||||
strcpy(large_image_text, full_level_name);
|
||||
|
||||
Reference in New Issue
Block a user