jak-project/game/external/discord_jak1.cpp
Hat Kid d8cca2bf83
game: refactor discord code and improve jak 2 support (#2714)
The Discord RPC code has been cleaned up and split up between game
versions.

For Jak 2, the Discord integration now shows large images for all levels
(with corresponding day and nighttime variants if required) and small
images for time of day and various states like being on the jetboard,
driving a zoomer, playing as Daxter, etc.

TODO:
- [x] mission specific images and detection
- [x] detect side missions properly
- [x] `onin-game` detection


![image](https://github.com/open-goal/jak-project/assets/6624576/35ec273f-404c-4475-a7c7-06121a17b1a5)

![image](https://github.com/open-goal/jak-project/assets/6624576/8456f5e2-4f96-4c72-ae9e-d930d76c93af)

![image](https://github.com/open-goal/jak-project/assets/6624576/9a17a0ec-c9bd-40fa-8556-f139712d8f07)

---------

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2023-06-17 05:16:40 +01:00

50 lines
2.6 KiB
C++

#include "discord_jak1.h"
namespace jak1 {
const std::map<std::string, std::string> level_names = {{"intro", "Intro"},
{"title", "Title screen"},
{"training", "Geyser Rock"},
{"village1", "Sandover Village"},
{"beach", "Sentinel Beach"},
{"jungle", "Forbidden Jungle"},
{"misty", "Misty Island"},
{"firecanyon", "Fire Canyon"},
{"village2", "Rock Village"},
{"swamp", "Boggy Swamp"},
{"rolling", "Precursor Basin"},
{"sunken", "Lost Precursor City"},
{"ogre", "Mountain Pass"},
{"village3", "Volcanic Crater"},
{"snow", "Snowy Mountain"},
{"maincave", "Spider Cave"},
{"lavatube", "Lava Tube"},
{"citadel", "Gol and Maia's Citadel"},
{"finalboss", "Final Boss"}};
// for remapping sub-level names to the matching one in level_names
const std::map<std::string, std::string> level_name_remap = {{"jungleb", "jungle"},
{"sunkenb", "sunken"},
{"robocave", "maincave"},
{"darkcave", "maincave"}};
// levels that are not affected by time of day
const std::vector<std::string> indoor_levels = {
"intro", "title", "jungleb", "sunken", "sunkenb",
"maincave", "robocave", "darkcave", "lavatube", "citadel",
};
// time of day string to append to level name for icons
const char* time_of_day_str(float time) {
int hour = static_cast<int>(time);
if (hour >= 0 && hour <= 9) {
return "green-sun";
} else if (hour < 22) {
return "day";
} else if (hour < 25) {
return "evening";
} else {
return "";
}
}
} // namespace jak1