Merge branch 'Galaxy-Redux' of https://git.do.srb2.org/Galactice/Kart-Public into Glalxy
This commit is contained in:
commit
e0f0552be2
13 files changed
+475
-20
No files matched your search
@@ -537,6 +537,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/comptime.o \
|
||||
$(OBJDIR)/string.o \
|
||||
$(OBJDIR)/d_main.o \
|
||||
$(OBJDIR)/d_protocol.o \
|
||||
$(OBJDIR)/d_clisrv.o \
|
||||
$(OBJDIR)/d_net.o \
|
||||
$(OBJDIR)/d_netfil.o \
|
||||
|
||||
+35
-2
@@ -77,6 +77,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||
#include "r_fps.h" // Frame interpolation/uncapped
|
||||
#include "keys.h"
|
||||
#include "filesrch.h" // refreshdirmenu
|
||||
#include "d_protocol.h"
|
||||
|
||||
#ifdef CMAKECONFIG
|
||||
#include "config.h"
|
||||
@@ -1225,6 +1226,8 @@ void D_SRB2Main(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
D_SetupProtocol();
|
||||
|
||||
// rand() needs seeded regardless of password
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
@@ -1324,7 +1327,7 @@ void D_SRB2Main(void)
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
for (wadnum = 4; wadnum < 6; wadnum++) // fucking arbitrary numbers
|
||||
for (wadnum = 0; wadnum < mainwads; wadnum++)
|
||||
{
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++)
|
||||
@@ -1539,7 +1542,7 @@ void D_SRB2Main(void)
|
||||
if (D_CheckNetGame())
|
||||
autostart = true;
|
||||
|
||||
if (splitscreen && !M_CheckParm("-connect")) // Make sure multiplayer & autostart is set if you have splitscreen, even after D_CheckNetGame
|
||||
if (splitscreen && !M_CheckParm("-connect") && !M_CheckProtoParam("ip")) // Make sure multiplayer & autostart is set if you have splitscreen, even after D_CheckNetGame
|
||||
multiplayer = autostart = true;
|
||||
|
||||
// check for a driver that wants intermission stats
|
||||
@@ -1600,6 +1603,36 @@ void D_SRB2Main(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
if (M_CheckProtoParam("replay"))
|
||||
{
|
||||
const char *replayurl = M_GetProtoParam();
|
||||
char *replayname = strrchr(replayurl, '/');
|
||||
|
||||
if (!replayname || !replayurl)
|
||||
I_Error("REPLAY: Invalid URL.");
|
||||
|
||||
#define REPLAYDIR "/DownloadedReplays/"
|
||||
I_mkdir(va("%s%s", srb2home, REPLAYDIR), 0755);
|
||||
CONS_Printf("bruh %s", va("%s%s%s", srb2home, REPLAYDIR, replayname));
|
||||
|
||||
// check if file already exists
|
||||
if (access(va("%s%s%s", srb2home, REPLAYDIR, replayurl), F_OK )!=0)
|
||||
D_DownloadReplay(replayurl, va("%s%s%s", srb2home, REPLAYDIR, replayname));
|
||||
|
||||
// add .lmp to identify the EXTERNAL demo file
|
||||
// it is NOT possible to play an internal demo using -playdemo,
|
||||
// rather push a playdemo command.. to do.
|
||||
|
||||
G_DeferedPlayDemo(va("%s%s", REPLAYDIR, replayname));
|
||||
#undef REPLAYDIR
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*if (M_CheckParm("-ultimatemode"))
|
||||
{
|
||||
autostart = true;
|
||||
|
||||
@@ -109,6 +109,7 @@ size_t nameonlylength(const char *s);
|
||||
void CURLPrepareFile(const char* url, int dfilenum);
|
||||
void CURLGetFile(void);
|
||||
HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next);
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#endif
|
||||
|
||||
#endif // __D_NETFIL__
|
||||
@@ -0,0 +1,274 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2021 by "Fafabis".
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file d_protocol.c
|
||||
/// \brief srb2kart:// protocol stuff
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#if defined (__unix__) || defined (UNIXCOMMON)
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#elif defined (__WIN32)
|
||||
#include <tchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "m_argv.h"
|
||||
#include "d_main.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "d_netfil.h"
|
||||
#include "d_protocol.h"
|
||||
#include "i_system.h"
|
||||
|
||||
// PROTOS
|
||||
#if defined (__WIN32)
|
||||
static HKEY OpenKey(HKEY hRootKey, const char* strKey);
|
||||
static boolean SetStringValue(HKEY hRegistryKey, const char *valueName, const char *data);
|
||||
#endif
|
||||
|
||||
static char *GetExePath(void)
|
||||
{
|
||||
static char buf[PATH_MAX];
|
||||
#if defined (__linux__)
|
||||
if (readlink("/proc/self/exe", buf, PATH_MAX) < 0)
|
||||
I_Error("PROTOCOL: Error reading /proc/");
|
||||
#elif defined (__FreeBSD__)
|
||||
if (readlink("/proc/curproc/file", buf, PATH_MAX) < 0)
|
||||
I_Error("PROTOCOL: Error reading /proc/");
|
||||
#elif defined (__WIN32)
|
||||
GetModuleFileName(NULL, buf, PATH_MAX);
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
||||
static boolean RegisterProtocols(const char *path)
|
||||
{
|
||||
#if defined (__WIN32)
|
||||
HKEY hKey = OpenKey(HKEY_CURRENT_USER,"Software\\Classes\\srb2kart");
|
||||
SetStringValue(hKey, "URL Protocol", "");
|
||||
RegCloseKey(hKey);
|
||||
hKey = OpenKey(HKEY_CURRENT_USER,"Software\\Classes\\srb2kart\\shell\\open\\command");
|
||||
SetStringValue(hKey, "", va("\"%s\" \"%%1\"", path));
|
||||
RegCloseKey(hKey);
|
||||
#elif defined (__unix__) || defined (UNIXCOMMON)
|
||||
FILE *desktopfile = NULL;
|
||||
FILE *mimefile = NULL;
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
char buffer[255];
|
||||
boolean alreadyexists = false;
|
||||
boolean newfolder = false;
|
||||
struct stat sb;
|
||||
char *applicationsfolder = va("%s/.local/share/applications/", homedir);
|
||||
|
||||
if (system("which update-desktop-database > /dev/null 2>&1"))
|
||||
{
|
||||
// command not found, probably doesn't have freedesktop, so let's ignore
|
||||
CONS_Alert(CONS_ERROR, "Unable to register protocols. Your system doesn't seem to have freedesktop.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stat(applicationsfolder, &sb) == -1)
|
||||
{
|
||||
// location doesn't exist, so let's actually create it
|
||||
newfolder = true;
|
||||
I_mkdir(applicationsfolder, 0755);
|
||||
}
|
||||
|
||||
desktopfile = fopen(va("%s/.local/share/applications/srb2kart-handler.desktop", homedir), "w");
|
||||
if (!desktopfile)
|
||||
I_Error("Unable to register protocols. Error creating .desktop file.");
|
||||
|
||||
fprintf(desktopfile,
|
||||
"[Desktop Entry]\n"
|
||||
"Type=Application\n"
|
||||
"Name=SRB2Kart Scheme Handler\n"
|
||||
"Exec=bash -c '%s %%u'\n"
|
||||
"NoDisplay=true\n"
|
||||
"StartupNotify=false\n"
|
||||
"MimeType=x-scheme-handler/srb2kart;\n",
|
||||
path);
|
||||
|
||||
fclose(desktopfile);
|
||||
|
||||
mimefile = fopen(va("%s/.local/share/applications/mimeinfo.cache", homedir), "a+");
|
||||
if (!mimefile)
|
||||
I_Error("Unable to register protocols. Error opening mime file.");
|
||||
|
||||
while (fgets(buffer, 255, mimefile))
|
||||
{
|
||||
if (strncmp(buffer, "x-scheme-handler/srb2kart=srb2kart-handler.desktop;", 43)==0)
|
||||
{
|
||||
alreadyexists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyexists)
|
||||
fprintf(mimefile, "x-scheme-handler/srb2kart=srb2kart-handler.desktop;\n");
|
||||
|
||||
if (newfolder)
|
||||
{
|
||||
if (system(va("update-desktop-database %s/.local/share/applications/", homedir)) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Unable to register protocols. Could not run call to run update-desktop-database sucessfully.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static void DeleteProtocols(void)
|
||||
{
|
||||
#if defined (__WIN32)
|
||||
|
||||
HKEY hKey;
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command"), 0, KEY_ALL_ACCESS, &hKey);
|
||||
RegDeleteValue(hKey, _T(""));
|
||||
RegCloseKey(hKey);
|
||||
RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command"));
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open"), 0, KEY_ALL_ACCESS, &hKey);
|
||||
RegDeleteValue(hKey, _T(""));
|
||||
RegCloseKey(hKey);
|
||||
RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open"));
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell"), 0, KEY_ALL_ACCESS, &hKey);
|
||||
RegDeleteValue(hKey, _T(""));
|
||||
RegCloseKey(hKey);
|
||||
RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell"));
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart"), 0, KEY_ALL_ACCESS, &hKey);
|
||||
RegDeleteValue(hKey, _T("URL Protocol"));
|
||||
RegDeleteValue(hKey, _T(""));
|
||||
RegCloseKey(hKey);
|
||||
RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart"));
|
||||
#elif defined (__unix__) || defined (UNIXCOMMON)
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
remove(va("%s/.local/share/applications/srb2kart-handler.desktop", homedir));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (__WIN32)
|
||||
static HKEY OpenKey(HKEY hRootKey, const char* strKey)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG nError = RegOpenKeyEx(hRootKey, strKey, 0, KEY_ALL_ACCESS, &hKey);
|
||||
|
||||
if (nError==ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
CONS_Printf("PROTOCOL: Creating registry key: %s\n", strKey);
|
||||
nError = RegCreateKeyEx(hRootKey, strKey, 0, NULL, REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL, &hKey, NULL);
|
||||
}
|
||||
|
||||
if (nError)
|
||||
I_Error("Unable to register protocols. Could not create Registry Key.");
|
||||
|
||||
return hKey;
|
||||
}
|
||||
|
||||
static boolean SetStringValue(HKEY hRegistryKey, const char *valueName, const char *data)
|
||||
{
|
||||
I_Assert(hRegistryKey != NULL);
|
||||
|
||||
return (RegSetValueExA(hRegistryKey,
|
||||
valueName,
|
||||
0,
|
||||
REG_SZ,
|
||||
(const BYTE *)data,
|
||||
strlen(data) + 1) == ERROR_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
void D_SetupProtocol(void)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char *result = NULL;
|
||||
char buffer[PATH_MAX];
|
||||
const char *exe_path = GetExePath();
|
||||
const char *protocolfile = va("%s/protocol.txt", srb2home);
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
fp = fopen(protocolfile, "a+");
|
||||
result = fgets(buffer, PATH_MAX, fp);
|
||||
if (result)
|
||||
{
|
||||
if (strcmp(buffer, "no") == 0)
|
||||
return;
|
||||
else if (strcmp(buffer, exe_path) != 0)
|
||||
{
|
||||
// overwrite
|
||||
fp = fopen(protocolfile, "w");
|
||||
RegisterProtocols(exe_path);
|
||||
fprintf(fp, "%s", exe_path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // probably first time
|
||||
{
|
||||
if (RegisterProtocols(exe_path))
|
||||
fprintf(fp, "%s", exe_path);
|
||||
else
|
||||
fprintf(fp, "no");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void D_DeleteProtocol(void)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
DeleteProtocols();
|
||||
fp = fopen(va("%s/protocol.txt", srb2home), "w");
|
||||
fprintf(fp, "no");
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void D_CreateProtocol(void)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
const char *exe_path = GetExePath();
|
||||
fp = fopen(va("%s/protocol.txt", srb2home), "w");
|
||||
RegisterProtocols(exe_path);
|
||||
fprintf(fp, "%s", exe_path);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
void D_DownloadReplay(const char *url, const char *path)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
CURL *curl;
|
||||
CURLcode cc;
|
||||
curl = curl_easy_init();
|
||||
if (!curl)
|
||||
I_Error("Unable to download replay. Error initializing CURL.");
|
||||
|
||||
fp = fopen(path, "wb");
|
||||
CONS_Printf("REPLAY: URL: %s\n", url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlwrite_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
|
||||
|
||||
cc = curl_easy_perform(curl);
|
||||
if (cc != CURLE_OK)
|
||||
I_Error("Unable to download replay. URL gave response code %u.", cc);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2021 by "Fafabis".
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file d_protocol.h
|
||||
/// \brief srb2kart:// protocol stuff
|
||||
|
||||
void D_SetupProtocol(void);
|
||||
|
||||
void D_CreateProtocol(void);
|
||||
void D_DeleteProtocol(void);
|
||||
#ifdef HAVE_CURL
|
||||
void D_DownloadReplay(const char *url, const char *path);
|
||||
#endif
|
||||
+3
-1
@@ -529,8 +529,10 @@ void DRPC_UpdatePresence(void)
|
||||
else
|
||||
{
|
||||
// Map name on tool tip
|
||||
snprintf(mapname, 48, "Map: %s", G_BuildMapTitle(gamemap));
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(mapname, 48, "Map: %s", title);
|
||||
discordPresence.largeImageText = mapname;
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && Playing())
|
||||
|
||||
+2
-2
@@ -149,8 +149,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Galaxy(v1.6) #1"
|
||||
#define VERSIONSTRINGW L"Galaxy(v1.6) #1"
|
||||
#define VERSIONSTRING "Galaxy(v1.6) v1.1"
|
||||
#define VERSIONSTRINGW L"Galaxy(v1.6) v1.1"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
|
||||
+8
-6
@@ -1526,22 +1526,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
forward += ((axis * forwardmove[1]) >> 10)*2;
|
||||
forward += ((axis * forwardmove[1]) / (JOYAXISRANGE-1));
|
||||
}
|
||||
|
||||
axis = JoyAxis(AXISBRAKE, ssplayer);
|
||||
if (InputDown(gc_brake, ssplayer) || (gamepadjoystickmove && axis > 0))
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
|
||||
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||
forward -= ((axis * forwardmove[0]) >> 10);
|
||||
forward -= ((axis * forwardmove[0]) / (JOYAXISRANGE-1));
|
||||
}
|
||||
|
||||
// But forward/backward IS used for aiming.
|
||||
@@ -6804,7 +6802,11 @@ void G_BeginRecording(void)
|
||||
|
||||
// Full replay title
|
||||
demo_p += 64;
|
||||
snprintf(demo.titlename, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Time Attack" : connectedservername);
|
||||
{
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(demo.titlename, 64, "%s - %s", title, modeattacking ? "Time Attack" : connectedservername);
|
||||
Z_Free(title);
|
||||
}
|
||||
|
||||
// demo checksum
|
||||
demo_p += 16;
|
||||
|
||||
+27
@@ -182,6 +182,7 @@ static UINT8 UPNP_support = TRUE;
|
||||
#include "i_tcp.h"
|
||||
#include "m_argv.h"
|
||||
#include "stun.h"
|
||||
#include "d_main.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
@@ -1872,6 +1873,32 @@ boolean I_InitTcpNetwork(void)
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
}
|
||||
}
|
||||
if (M_CheckProtoParam("ip"))
|
||||
{
|
||||
COM_ImmedExecute(va("exec \"%s"PATHSEP"kartexec.cfg\" -noerror\n", srb2home));
|
||||
|
||||
strcpy(serverhostname, M_GetProtoParam());
|
||||
|
||||
// server address only in ip
|
||||
if (serverhostname[0])
|
||||
{
|
||||
CONS_Printf("SERVERNAME: %s\n", serverhostname);
|
||||
COM_BufAddText("connect \"");
|
||||
COM_BufAddText(serverhostname);
|
||||
COM_BufAddText("\"\n");
|
||||
|
||||
// probably modem
|
||||
hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
// so we're on a LAN
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
net_bandwidth = 800000;
|
||||
hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
I_NetOpenSocket = SOCK_OpenSocket;
|
||||
I_Ban = SOCK_Ban;
|
||||
|
||||
@@ -59,6 +59,51 @@ INT32 M_CheckParm(const char *check)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Check params for URL protocol
|
||||
|
||||
\return number (1 to argc-1) or 0 if not present
|
||||
*/
|
||||
INT32 M_CheckProtoParam(const char *check)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
if (strncmp(myargv[i]+11, check, strlen(check))==0)
|
||||
{
|
||||
found = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
found = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Gets the string after URL protocol
|
||||
*
|
||||
\return string after protocol parameter or NULL if not found
|
||||
*/
|
||||
const char *M_GetProtoParam(void)
|
||||
{
|
||||
INT32 i;
|
||||
static char *string;
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
string = strchr(myargv[i], '/');
|
||||
string = strchr(string+1, '/');
|
||||
string = strchr(string+1, '/')+1;
|
||||
return string;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief the M_IsNextParm
|
||||
|
||||
\return true if there is an available next parameter
|
||||
|
||||
@@ -24,6 +24,12 @@ extern boolean myargmalloc;
|
||||
// Returns the position of the given parameter in the arg list (0 if not found).
|
||||
INT32 M_CheckParm(const char *check);
|
||||
|
||||
// Check params for srb2kart:// protocol
|
||||
INT32 M_CheckProtoParam(const char *check);
|
||||
|
||||
// Gets the string after srb2kart://
|
||||
const char *M_GetProtoParam(void);
|
||||
|
||||
// Pushes all parameters beginning with a +, ex: +map map01
|
||||
void M_PushSpecialParameters(void);
|
||||
|
||||
|
||||
+54
-8
@@ -70,6 +70,9 @@
|
||||
// And just some randomness for the exits.
|
||||
#include "m_random.h"
|
||||
|
||||
// protocol handling
|
||||
#include "d_protocol.h"
|
||||
|
||||
#if defined(HAVE_SDL)
|
||||
#include "SDL.h"
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
@@ -318,6 +321,7 @@ menu_t OP_SoundOptionsDef;
|
||||
|
||||
//Misc
|
||||
menu_t OP_DataOptionsDef, OP_ScreenshotOptionsDef, OP_EraseDataDef;
|
||||
menu_t OP_ProtocolDef;
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t OP_DiscordOptionsDef;
|
||||
#endif
|
||||
@@ -335,6 +339,8 @@ static void M_Addons(INT32 choice);
|
||||
static void M_AddonsOptions(INT32 choice);
|
||||
static patch_t *addonsp[NUM_EXT+5];
|
||||
|
||||
static void M_DeleteProtocol(void);
|
||||
|
||||
// Bird
|
||||
menu_t OP_BirdDef;
|
||||
// Stuff, yknow.
|
||||
@@ -1393,12 +1399,13 @@ static menuitem_t OP_DataOptionsMenu[] =
|
||||
{IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 10},
|
||||
{IT_STRING | IT_CALL, NULL, "Addon Options...", M_AddonsOptions, 20},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Replay Options...", &MISC_ReplayOptionsDef, 30},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Protocol options...", &OP_ProtocolDef, 40},
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Discord Options...", &OP_DiscordOptionsDef, 40},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Discord Options...", &OP_DiscordOptionsDef, 50},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Erase Data...", &OP_EraseDataDef, 60},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Erase Data...", &OP_EraseDataDef, 70},
|
||||
#else
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Erase Data...", &OP_EraseDataDef, 50},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Erase Data...", &OP_EraseDataDef, 60},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1461,6 +1468,12 @@ enum
|
||||
op_addons_folder = 2,
|
||||
};
|
||||
|
||||
static menuitem_t OP_ProtocolMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Register protocol", D_CreateProtocol, 10},
|
||||
{IT_STRING | IT_CALL, NULL, "\x85" "Disable and delete protocols", M_DeleteProtocol, 20},
|
||||
};
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
static menuitem_t OP_DiscordOptionsMenu[] =
|
||||
{
|
||||
@@ -2234,6 +2247,7 @@ menu_t OP_OpenGLColorDef =
|
||||
menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30);
|
||||
menu_t OP_ScreenshotOptionsDef = DEFAULTMENUSTYLE("M_SCSHOT", OP_ScreenshotOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
menu_t OP_ProtocolDef = DEFAULTMENUSTYLE(NULL, OP_ProtocolMenu, &OP_DataOptionsDef, 30, 30);
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
#endif
|
||||
@@ -5961,7 +5975,11 @@ static void DrawReplayHutReplayInfo(void)
|
||||
x += 85;
|
||||
|
||||
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
|
||||
V_DrawString(x, y, V_SNAPTOTOP, G_BuildMapTitle(demolist[dir_on[menudepthleft]].map));
|
||||
{
|
||||
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
|
||||
V_DrawString(x, y, V_SNAPTOTOP, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
V_DrawString(x, y, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
|
||||
|
||||
@@ -6898,16 +6916,36 @@ static char *M_GetConditionString(condition_t cond)
|
||||
G_TicsToMinutes(cond.requirement, false),
|
||||
G_TicsToSeconds(cond.requirement));
|
||||
case UC_MAPVISITED:
|
||||
return va("Visit %s", G_BuildMapTitle(cond.requirement-1));
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Visit %s", title);
|
||||
Z_Free(title);
|
||||
return response;
|
||||
}
|
||||
case UC_MAPBEATEN:
|
||||
return va("Beat %s", G_BuildMapTitle(cond.requirement-1));
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Beat %s", title);
|
||||
Z_Free(title);
|
||||
return response;
|
||||
}
|
||||
case UC_MAPALLEMERALDS:
|
||||
return va("Beat %s w/ all emeralds", G_BuildMapTitle(cond.requirement-1));
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.requirement-1);
|
||||
char *response = va("Beat %s w/ all emeralds", title);
|
||||
Z_Free(title);
|
||||
return response;
|
||||
}
|
||||
case UC_MAPTIME:
|
||||
return va("Beat %s in %i:%02i.%02i", G_BuildMapTitle(cond.extrainfo1-1),
|
||||
{
|
||||
char *title = G_BuildMapTitle(cond.extrainfo1-1);
|
||||
char *response = va("Beat %s in %i:%02i.%02i", title,
|
||||
G_TicsToMinutes(cond.requirement, true),
|
||||
G_TicsToSeconds(cond.requirement),
|
||||
G_TicsToCentiseconds(cond.requirement));
|
||||
Z_Free(title);
|
||||
return response;
|
||||
}
|
||||
case UC_TOTALEMBLEMS:
|
||||
return va("Get %d medals", cond.requirement);
|
||||
case UC_EXTRAEMBLEM:
|
||||
@@ -11070,6 +11108,14 @@ static void M_ScreenshotOptions(INT32 choice)
|
||||
M_SetupNextMenu(&OP_ScreenshotOptionsDef);
|
||||
}
|
||||
|
||||
static void M_DeleteProtocol(void)
|
||||
{
|
||||
M_StartMessage("Are you sure you want to disable and delete protocol registers?\n"
|
||||
"Protocols can be registered again with the Register Protocol option in this menu\n\n"
|
||||
"(Press 'Y' to confirm)\n",
|
||||
D_DeleteProtocol, MM_YESNO);
|
||||
}
|
||||
|
||||
// =============
|
||||
// JOYSTICK MENU
|
||||
// =============
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
|
||||
#ifdef HAVE_IMAGE
|
||||
#include "SDL_image.h"
|
||||
#elif 1
|
||||
#elif (!defined(__APPLE__))
|
||||
#define LOAD_XPM //I want XPM!
|
||||
#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so
|
||||
#define HAVE_IMAGE //I have SDL_Image, sortof
|
||||
|
||||
Reference in new issue
Block a user