- Discord RPC presence. Adds new IWADINFO and GAMEINFO keys: DiscordAppId - this should point to your AppId for your game. It will use a default GZDoom one if not found.
This commit is contained in:
parent
550e1212af
commit
85c432c699
90 changed files with 7344 additions and 3 deletions
|
|
@ -402,11 +402,11 @@ add_custom_target( revision_check ALL
|
|||
|
||||
# Libraries ZDoom needs
|
||||
|
||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${CMAKE_DL_LIBS}" )
|
||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${CMAKE_DL_LIBS}" "${DRPC_LIBRARIES}")
|
||||
if (HAVE_VULKAN)
|
||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} "glslang" "SPIRV" "OGLCompiler")
|
||||
endif()
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" )
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${DRPC_INCLUDE_DIR}")
|
||||
|
||||
if( ${HAVE_VM_JIT} )
|
||||
add_definitions( -DHAVE_VM_JIT )
|
||||
|
|
@ -819,6 +819,7 @@ set (POLYBACKEND_SOURCES
|
|||
set (FASTMATH_SOURCES ${FASTMATH_SOURCES} ${POLYBACKEND_SOURCES})
|
||||
|
||||
set (PCH_SOURCES
|
||||
richpresence.cpp
|
||||
am_map.cpp
|
||||
playsim/bots/b_bot.cpp
|
||||
playsim/bots/b_func.cpp
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ struct FStartupInfo
|
|||
FString Song;
|
||||
FString con;
|
||||
FString def;
|
||||
FString DiscordAppId = nullptr;
|
||||
int Type;
|
||||
int LoadLights = -1;
|
||||
int LoadBrightmaps = -1;
|
||||
|
|
|
|||
|
|
@ -239,6 +239,12 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
|
|||
sc.MustGetNumber();
|
||||
iwad->LoadWidescreen = sc.Number;
|
||||
}
|
||||
else if (sc.Compare("DiscordAppId"))
|
||||
{
|
||||
sc.MustGetStringName("=");
|
||||
sc.MustGetString();
|
||||
iwad->DiscordAppId = sc.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Unknown keyword '%s'", sc.String);
|
||||
|
|
@ -831,6 +837,7 @@ const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *i
|
|||
GameStartupInfo.LoadBrightmaps = iwad_info->LoadBrightmaps;
|
||||
if (GameStartupInfo.Type == 0) GameStartupInfo.Type = iwad_info->StartupType;
|
||||
if (GameStartupInfo.Song.IsEmpty()) GameStartupInfo.Song = iwad_info->Song;
|
||||
if (GameStartupInfo.DiscordAppId.IsEmpty()) GameStartupInfo.DiscordAppId = iwad_info->DiscordAppId;
|
||||
I_SetIWADInfo();
|
||||
return iwad_info;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ void M_SaveDefaultsFinal();
|
|||
void R_Shutdown();
|
||||
void I_ShutdownInput();
|
||||
void SetConsoleNotifyBuffer();
|
||||
void I_UpdateDiscordPresence(bool SendPresence, const char* curstatus, const char* appid);
|
||||
|
||||
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
|
||||
|
||||
|
|
@ -1875,6 +1876,11 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
|
|||
sc.MustGetNumber();
|
||||
GameStartupInfo.LoadWidescreen = !!sc.Number;
|
||||
}
|
||||
else if (!nextKey.CompareNoCase("DISCORDAPPID"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
GameStartupInfo.DiscordAppId = !!sc.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Silently ignore unknown properties
|
||||
|
|
@ -3696,6 +3702,7 @@ void D_Cleanup()
|
|||
GameStartupInfo.Name = "";
|
||||
GameStartupInfo.BkColor = GameStartupInfo.FgColor = GameStartupInfo.Type = 0;
|
||||
GameStartupInfo.LoadWidescreen = GameStartupInfo.LoadLights = GameStartupInfo.LoadBrightmaps = -1;
|
||||
GameStartupInfo.DiscordAppId = "";
|
||||
|
||||
GC::FullGC(); // clean up before taking down the object list.
|
||||
|
||||
|
|
@ -3785,6 +3792,7 @@ void I_UpdateWindowTitle()
|
|||
titlestr = GameStartupInfo.Name;
|
||||
break;
|
||||
default:
|
||||
I_UpdateDiscordPresence(false, NULL, GameStartupInfo.DiscordAppId.GetChars());
|
||||
I_SetWindowTitle(NULL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -3814,5 +3822,6 @@ void I_UpdateWindowTitle()
|
|||
}
|
||||
}
|
||||
*dstp = 0;
|
||||
I_UpdateDiscordPresence(true, copy.Data(), GameStartupInfo.DiscordAppId.GetChars());
|
||||
I_SetWindowTitle(copy.Data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ struct FIWADInfo
|
|||
int LoadWidescreen = -1;
|
||||
int LoadBrightmaps = -1;
|
||||
int LoadLights = -1;
|
||||
FString DiscordAppId = nullptr;
|
||||
};
|
||||
|
||||
struct FFoundWadInfo
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ const char *GetVersionString();
|
|||
#define GAME_DIR ".config/" GAMENAMELOWERCASE
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DISCORD_APP_ID "951303644597325885"
|
||||
|
||||
const int SAVEPICWIDTH = 216;
|
||||
const int SAVEPICHEIGHT = 162;
|
||||
const int VID_MIN_WIDTH = 320;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue