Merge branch 'manual-link' into 'master'

Add Online Manual and I_OpenURL stuff

See merge request KartKrew/Kart!2396
This commit is contained in:
Oni 2024-05-20 21:20:19 +00:00
commit 93dae32e99
5 changed files with 64 additions and 0 deletions

View file

@ -195,5 +195,15 @@ void I_GetCursorPosition(INT32 *x, INT32 *y)
(void)y; (void)y;
} }
boolean I_HasOpenURL()
{
return 0;
}
void I_OpenURL(const char *data)
{
return;
}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"

View file

@ -309,6 +309,10 @@ void I_RegisterSysCommands(void);
void I_CursedWindowMovement(int xd, int yd); void I_CursedWindowMovement(int xd, int yd);
boolean I_HasOpenURL(void);
void I_OpenURL(const char *data);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

View file

@ -1213,6 +1213,7 @@ extern struct extrasmenu_s {
typedef enum typedef enum
{ {
extras_addons = 0, extras_addons = 0,
extras_manual,
extras_tutorial, extras_tutorial,
extras_challenges, extras_challenges,
extras_statistics, extras_statistics,

View file

@ -17,6 +17,7 @@
#include "../f_finale.h" #include "../f_finale.h"
#include "../k_credits.h" #include "../k_credits.h"
#include "../m_pw.h" #include "../m_pw.h"
#include "../i_system.h"
static void M_Credits(INT32 choice) static void M_Credits(INT32 choice)
{ {
@ -26,6 +27,32 @@ static void M_Credits(INT32 choice)
F_StartCredits(); F_StartCredits();
} }
const char *manual_url = "https://kartkrew.org/rr-manual";
static void M_ManualSelect(INT32 choice)
{
if (choice != MA_YES)
return;
I_OpenURL(manual_url);
}
static void M_Manual(INT32 choice)
{
(void)choice;
restoreMenu = currentMenu;
if (I_HasOpenURL())
{
M_StartMessage("Online Manual", va("This will open a page in your default browser:\n\x86%s", manual_url), M_ManualSelect, MM_YESNO, "Let's go!", "Not now...");
}
else
{
I_ClipboardCopy(manual_url, strlen(manual_url));
M_StartMessage("Online Manual", va("A URL has been copied to your clipboard:\n\x86%s", manual_url), NULL, MM_NOTHING, NULL, NULL);
}
}
menuitem_t EXTRAS_Main[] = menuitem_t EXTRAS_Main[] =
{ {
// The following has NULL strings for text and tooltip. // The following has NULL strings for text and tooltip.
@ -35,6 +62,9 @@ menuitem_t EXTRAS_Main[] =
{IT_STRING | IT_CALL, NULL, NULL, {IT_STRING | IT_CALL, NULL, NULL,
NULL, {.routine = M_Addons}, 0, 0}, NULL, {.routine = M_Addons}, 0, 0},
{IT_STRING | IT_CALL, "Online Manual", "Learn everything there is to know about handling, items, and strategy.",
NULL, {.routine = M_Manual}, 0, 0},
{IT_STRING | IT_CALL, "Tutorial", "Help Dr. Robotnik and Tails test out their new Ring Racers.", {IT_STRING | IT_CALL, "Tutorial", "Help Dr. Robotnik and Tails test out their new Ring Racers.",
NULL, {.routine = M_LevelSelectInit}, 0, GT_TUTORIAL}, NULL, {.routine = M_LevelSelectInit}, 0, GT_TUTORIAL},

View file

@ -1013,6 +1013,25 @@ I_CursedWindowMovement (int xd, int yd)
SDL_SetWindowPosition(window, window_x + xd, window_y + yd); SDL_SetWindowPosition(window, window_x + xd, window_y + yd);
} }
boolean I_HasOpenURL()
{
#if (SDL_VERSION_ATLEAST(2, 0, 14))
return true;
#else
return false;
#endif
}
void I_OpenURL(const char *data)
{
#if (SDL_VERSION_ATLEAST(2, 0, 14))
SDL_OpenURL(data);
#else
(void)data;
return;
#endif
}
// //
// I_JoyScale // I_JoyScale
// //