mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-04 07:52:22 +00:00
CL_CONFIRMCONNECT: Attempt to fix the issue with the Menu Message not sliding
The author of this commit *needs* netgame testing, Rean
This commit is contained in:
parent
6c6306889a
commit
953abf7d26
3 changed files with 47 additions and 26 deletions
|
|
@ -653,6 +653,7 @@ typedef enum
|
||||||
static void GetPackets(void);
|
static void GetPackets(void);
|
||||||
|
|
||||||
static cl_mode_t cl_mode = CL_SEARCHING;
|
static cl_mode_t cl_mode = CL_SEARCHING;
|
||||||
|
static cl_mode_t cl_requestmode = CL_ABORTED;
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
char http_source[MAX_MIRROR_LENGTH];
|
char http_source[MAX_MIRROR_LENGTH];
|
||||||
|
|
@ -1670,8 +1671,14 @@ void CL_UpdateServerList (void)
|
||||||
SendAskInfo(BROADCASTADDR);
|
SendAskInfo(BROADCASTADDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_ConfirmConnect(void)
|
static boolean M_ConfirmConnect(void)
|
||||||
{
|
{
|
||||||
|
if (G_PlayerInputDown(0, gc_b, 1) || G_PlayerInputDown(0, gc_x, 1) || G_GetDeviceGameKeyDownArray(0)[KEY_ESCAPE])
|
||||||
|
{
|
||||||
|
cl_requestmode = CL_ABORTED;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (G_PlayerInputDown(0, gc_a, 1) || G_GetDeviceGameKeyDownArray(0)[KEY_ENTER])
|
if (G_PlayerInputDown(0, gc_a, 1) || G_GetDeviceGameKeyDownArray(0)[KEY_ENTER])
|
||||||
{
|
{
|
||||||
if (totalfilesrequestednum > 0)
|
if (totalfilesrequestednum > 0)
|
||||||
|
|
@ -1682,28 +1689,25 @@ static void M_ConfirmConnect(void)
|
||||||
{
|
{
|
||||||
if (CL_SendFileRequest())
|
if (CL_SendFileRequest())
|
||||||
{
|
{
|
||||||
cl_mode = CL_DOWNLOADFILES;
|
cl_requestmode = CL_DOWNLOADFILES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cl_mode = CL_DOWNLOADFAILED;
|
cl_requestmode = CL_DOWNLOADFAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
else
|
else
|
||||||
cl_mode = CL_PREPAREHTTPFILES;
|
cl_requestmode = CL_PREPAREHTTPFILES;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cl_mode = CL_LOADFILES;
|
cl_requestmode = CL_LOADFILES;
|
||||||
|
|
||||||
M_StopMessage(0);
|
return true;
|
||||||
}
|
|
||||||
else if (G_PlayerInputDown(0, gc_b, 1) || G_PlayerInputDown(0, gc_x, 1) || G_GetDeviceGameKeyDownArray(0)[KEY_ESCAPE])
|
|
||||||
{
|
|
||||||
cl_mode = CL_ABORTED;
|
|
||||||
M_StopMessage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean CL_FinishedFileList(void)
|
static boolean CL_FinishedFileList(void)
|
||||||
|
|
@ -2166,7 +2170,16 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
|
|
||||||
if (cl_mode == CL_CONFIRMCONNECT)
|
if (cl_mode == CL_CONFIRMCONNECT)
|
||||||
{
|
{
|
||||||
M_ConfirmConnect();
|
#ifdef HAVE_THREADS
|
||||||
|
I_lock_mutex(&k_menu_mutex);
|
||||||
|
#endif
|
||||||
|
if (M_MenuMessageTick() && M_ConfirmConnect())
|
||||||
|
M_StopMessage(0);
|
||||||
|
else if (menumessage.active == false)
|
||||||
|
cl_mode = cl_requestmode;
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
I_unlock_mutex(k_menu_mutex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2252,6 +2265,7 @@ static void CL_ConnectToServer(void)
|
||||||
lastfilenum = -1;
|
lastfilenum = -1;
|
||||||
|
|
||||||
cl_mode = CL_SEARCHING;
|
cl_mode = CL_SEARCHING;
|
||||||
|
cl_requestmode = CL_ABORTED; // sane default
|
||||||
|
|
||||||
// Don't get a corrupt savegame error because tmpsave already exists
|
// Don't get a corrupt savegame error because tmpsave already exists
|
||||||
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
|
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
|
||||||
|
|
|
||||||
|
|
@ -538,7 +538,11 @@ extern struct menumessage_s
|
||||||
const char *confirmstr;
|
const char *confirmstr;
|
||||||
} menumessage;
|
} menumessage;
|
||||||
|
|
||||||
|
void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr);
|
||||||
|
boolean M_MenuMessageTick(void);
|
||||||
void M_HandleMenuMessage(void);
|
void M_HandleMenuMessage(void);
|
||||||
|
void M_StopMessage(INT32 choice);
|
||||||
|
void M_DrawMenuMessage(void);
|
||||||
|
|
||||||
#define MENUDELAYTIME 7
|
#define MENUDELAYTIME 7
|
||||||
#define MENUMINDELAY 2
|
#define MENUMINDELAY 2
|
||||||
|
|
@ -625,10 +629,6 @@ void M_PlayMenuJam(void);
|
||||||
|
|
||||||
void M_MenuTypingInput(INT32 key);
|
void M_MenuTypingInput(INT32 key);
|
||||||
|
|
||||||
void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr);
|
|
||||||
void M_StopMessage(INT32 choice);
|
|
||||||
void M_DrawMenuMessage(void);
|
|
||||||
|
|
||||||
void M_QuitResponse(INT32 ch);
|
void M_QuitResponse(INT32 ch);
|
||||||
void M_QuitSRB2(INT32 choice);
|
void M_QuitSRB2(INT32 choice);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ void M_StartMessage(const char *header, const char *string, void (*routine)(INT3
|
||||||
menumessage.header = header;
|
menumessage.header = header;
|
||||||
menumessage.flags = itemtype;
|
menumessage.flags = itemtype;
|
||||||
menumessage.routine = routine;
|
menumessage.routine = routine;
|
||||||
menumessage.fadetimer = (gamestate == GS_WAITINGPLAYERS) ? 9 : 1;
|
menumessage.fadetimer = 1;
|
||||||
menumessage.timer = 0;
|
menumessage.timer = 0;
|
||||||
menumessage.closing = false;
|
menumessage.closing = false;
|
||||||
menumessage.active = true;
|
menumessage.active = true;
|
||||||
|
|
@ -141,13 +141,8 @@ void M_StopMessage(INT32 choice)
|
||||||
M_SetMenuDelay(pid);
|
M_SetMenuDelay(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// regular handler for MM_NOTHING and MM_YESNO
|
boolean M_MenuMessageTick(void)
|
||||||
void M_HandleMenuMessage(void)
|
|
||||||
{
|
{
|
||||||
const UINT8 pid = 0;
|
|
||||||
boolean btok = M_MenuConfirmPressed(pid);
|
|
||||||
boolean btnok = M_MenuBackPressed(pid);
|
|
||||||
|
|
||||||
if (menumessage.closing)
|
if (menumessage.closing)
|
||||||
{
|
{
|
||||||
if (menumessage.fadetimer > 0)
|
if (menumessage.fadetimer > 0)
|
||||||
|
|
@ -160,22 +155,34 @@ void M_HandleMenuMessage(void)
|
||||||
menumessage.active = false;
|
menumessage.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (menumessage.fadetimer < 9)
|
else if (menumessage.fadetimer < 9)
|
||||||
{
|
{
|
||||||
menumessage.fadetimer++;
|
menumessage.fadetimer++;
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
menumessage.timer++;
|
menumessage.timer++;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// regular handler for MM_NOTHING and MM_YESNO
|
||||||
|
void M_HandleMenuMessage(void)
|
||||||
|
{
|
||||||
|
if (!M_MenuMessageTick())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const UINT8 pid = 0;
|
||||||
|
boolean btok = M_MenuConfirmPressed(pid);
|
||||||
|
boolean btnok = M_MenuBackPressed(pid);
|
||||||
|
|
||||||
switch (menumessage.flags)
|
switch (menumessage.flags)
|
||||||
{
|
{
|
||||||
// Send 1 to the routine if we're pressing A/B/X
|
// Send 1 to the routine if we're pressing A/B/X
|
||||||
case MM_NOTHING:
|
case MM_NOTHING:
|
||||||
{
|
{
|
||||||
// send 1 if any button is pressed, 0 otherwise.
|
|
||||||
if (btok || btnok)
|
if (btok || btnok)
|
||||||
menumessage.routine(0);
|
menumessage.routine(0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue