- fixed menu loop

This commit is contained in:
Christoph Oelckers 2020-07-04 22:30:18 +02:00
parent 2c494245ad
commit 2fba557a3d
2 changed files with 60 additions and 46 deletions

View file

@ -141,7 +141,7 @@ class DukeMainMenu : public DukeListMenu
double x = origin.X + 160; double x = origin.X + 160;
if (RRRA) if (RRRA)
{ {
DrawTexture(twod, tileGetTexture(TILE_THREEDEE), x-5, origin.Y+57, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.253, DTA_ScaleY, 0.253, DTA_CenterOffset, true, TAG_DONE); DrawTexture(twod, tileGetTexture(TILE_THREEDEE), x-5, origin.Y+57, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.253, DTA_ScaleY, 0.253, DTA_CenterBottomOffset, true, TAG_DONE);
} }
else if (isRR()) else if (isRR())
{ {

View file

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS BEGIN_DUKE_NS
//////////////////// ////////////////////
int32_t G_PlaybackDemo(void) int32_t G_PlaybackDemo(void)
@ -44,57 +43,63 @@ int32_t G_PlaybackDemo(void)
if (ready2send) if (ready2send)
return 0; return 0;
while (int in_menu = g_player[myconnectindex].ps->gm & MODE_MENU) RECHECK:
in_menu = g_player[myconnectindex].ps->gm&MODE_MENU;
if (foundemo == 0)
{ {
if (foundemo == 0) ud.recstat = 0;
//fadepal(0,0,0, 0,252,28);
drawbackground();
//M_DisplayMenus();
videoNextPage();
//fadepal(0,0,0, 252,0,-28);
ud.reccnt = 0;
}
if (foundemo == 0 || in_menu || inputState.CheckAllInput() || numplayers > 1)
{
FX_StopAllSounds();
M_StartControlPanel(false);
}
ready2send = 0;
inputState.ClearAllInput();
while (true)
{
// Main loop here. It also runs when there's no demo to show,
// so maybe a better name for this function would be
// G_MainLoopWhenNotInGame()?
if (G_FPSLimit())
{ {
ud.recstat = 0;
//fadepal(0,0,0, 0,252,28);
drawbackground();
//M_DisplayMenus();
videoNextPage();
//fadepal(0,0,0, 252,0,-28);
ud.reccnt = 0;
}
if (foundemo == 0 || in_menu || inputState.CheckAllInput() || numplayers > 1)
{
FX_StopAllSounds();
M_StartControlPanel(false);
}
ready2send = 0;
inputState.ClearAllInput();
while (true)
{
// Main loop here. It also runs when there's no demo to show,
// so maybe a better name for this function would be
// G_MainLoopWhenNotInGame()?
if (foundemo == 0) if (foundemo == 0)
{ {
drawbackground(); drawbackground();
} }
if ((g_player[myconnectindex].ps->gm & MODE_MENU) && (g_player[myconnectindex].ps->gm & MODE_EOL)) if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{ {
videoNextPage(); videoNextPage();
break; goto RECHECK;
} }
else if (g_player[myconnectindex].ps->gm & MODE_TYPE) else if (g_player[myconnectindex].ps->gm&MODE_TYPE)
{ {
if ((g_player[myconnectindex].ps->gm & MODE_TYPE) != MODE_TYPE) if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
{ {
g_player[myconnectindex].ps->gm = 0; g_player[myconnectindex].ps->gm = 0;
M_StartControlPanel(false); M_StartControlPanel(false);
} }
} }
else else
{ {
//if (ud.recstat != 2)
//M_DisplayMenus();
if ((g_netServer || ud.multimode > 1))// && !Menu_IsTextInput(m_currentMenu)) if ((g_netServer || ud.multimode > 1))// && !Menu_IsTextInput(m_currentMenu))
{ {
ControlInfo noshareinfo; ControlInfo noshareinfo;
@ -107,22 +112,31 @@ int32_t G_PlaybackDemo(void)
if (VOLUMEONE) if (VOLUMEONE)
{ {
if ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0) if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite_fs((320 - 50) << 16, 9 << 16, 65536L, 0, TILE_BETAVERSION, 0, 0, 2 + 8 + 16 + 128); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, TILE_BETAVERSION, 0, 0, 2+8+16+128);
} }
videoNextPage(); videoNextPage();
G_HandleAsync();
if (g_player[myconnectindex].ps->gm == MODE_GAME)
{
// user wants to play a game, quit showing demo!
return 0;
}
} }
ud.multimode = numplayers; // fixes 2 infinite loops after watching demo G_HandleAsync();
if (g_player[myconnectindex].ps->gm == MODE_GAME)
{
// user wants to play a game, quit showing demo!
return 0;
}
} }
ud.multimode = numplayers; // fixes 2 infinite loops after watching demo
// if we're in the menu, try next demo immediately
if (g_player[myconnectindex].ps->gm&MODE_MENU)
goto RECHECK;
// finished playing a demo and not in menu:
// return so that e.g. the title can be shown
return 1; return 1;
} }