- stripped down the main menu loop to the minimum needed to be able to run it.

This commit is contained in:
Christoph Oelckers 2020-07-06 08:55:56 +02:00
parent 736a52f7b2
commit 9300c0bdeb
10 changed files with 35 additions and 157 deletions

View file

@ -44,7 +44,6 @@ set( PCH_SOURCES
src/spawn_d.cpp
src/spawn_r.cpp
src/zz_common.cpp
src/zz_demo.cpp
src/zz_game.cpp
src/zz_global.cpp
src/zz_net.cpp

View file

@ -257,7 +257,6 @@ void GameInterface::MenuSound(EMenuSounds snd)
void GameInterface::MenuClosed()
{
auto& gm = g_player[myconnectindex].ps->gm;
if (gm & MODE_GAME)
{

View file

@ -241,7 +241,7 @@ inline bool wallswitchcheck(int s)
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (actorinfo[iPicnum].flags & iType) != 0)
#define S_StopSound(num) S_StopEnvSound(num, -1)
extern int G_StartRTS(int lumpNum, int localPlayer);
extern int startrts(int lumpNum, int localPlayer);
extern void G_MaybeAllocPlayer(int32_t pnum);

View file

@ -632,7 +632,7 @@ void cameratext(int i)
//
//---------------------------------------------------------------------------
int G_StartRTS(int lumpNum, int localPlayer)
int startrts(int lumpNum, int localPlayer)
{
if (SoundEnabled() &&
RTS_IsInitialized() && rtsplaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))

View file

@ -52,6 +52,30 @@ static inline int movefifoend(int myconnectindex)
}
*/
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int menuloop(void)
{
FX_StopAllSounds();
while (menuactive != MENU_Off)
{
handleevents();
drawbackground();
videoNextPage();
}
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void fakedomovethings()
{
// prediction

View file

@ -274,8 +274,7 @@ extern char CheatKeys[2];
extern char g_gametypeNames[MAXGAMETYPES][33];
extern int32_t respawnactortime;
extern int32_t g_bouncemineRadius;
#define bouncemineblastradius g_bouncemineRadius
extern int32_t bouncemineblastradius;
extern int32_t g_deleteQueueSize;
extern int32_t g_gametypeCnt;
extern int32_t respawnitemtime;
@ -343,7 +342,8 @@ struct psaccess
};
extern psaccess ps;
#define spriteqamount g_deleteQueueSize
extern int spriteqamount;
#define spriteq SpriteDeletionQueue
#define spriteqloc g_spriteDeleteQueuePos

View file

@ -1,143 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include "duke3d.h"
#include "savegame.h"
#include "screens.h"
BEGIN_DUKE_NS
////////////////////
int32_t G_PlaybackDemo(void)
{
int32_t foundemo = 0, outofsync=0;
static int32_t in_menu = 0;
totalclock = 0;
ototalclock = 0;
lockclock = 0;
if (ready2send)
return 0;
RECHECK:
in_menu = g_player[myconnectindex].ps->gm&MODE_MENU;
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())
{
if (foundemo == 0)
{
drawbackground();
}
if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{
videoNextPage();
goto RECHECK;
}
else if (g_player[myconnectindex].ps->gm&MODE_TYPE)
{
if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
{
g_player[myconnectindex].ps->gm = 0;
M_StartControlPanel(false);
}
}
else
{
//if (ud.recstat != 2)
//M_DisplayMenus();
if (ud.multimode > 1)// && !Menu_IsTextInput(m_currentMenu))
{
ControlInfo noshareinfo;
CONTROL_GetInput(&noshareinfo);
}
}
if (ud.last_camsprite != ud.camerasprite)
ud.last_camsprite = ud.camerasprite;
if (VOLUMEONE)
{
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);
}
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
// 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;
}
END_DUKE_NS

View file

@ -57,8 +57,10 @@ void InitCheats();
void checkcommandline();
int registerosdcommands(void);
int32_t G_MoveLoop(void);
int menuloop(void);
int16_t max_ammo_amount[MAX_WEAPONS];
int32_t spriteqamount = 64;
uint8_t shadedsector[MAXSECTORS];
@ -735,8 +737,6 @@ int GameInterface::app_main()
return 0;
}
int32_t G_PlaybackDemo(void);
void app_loop()
{
auto &myplayer = g_player[myconnectindex].ps;
@ -782,7 +782,7 @@ MAIN_LOOP_RESTART:
M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu);
if (G_PlaybackDemo())
if (menuloop())
{
FX_StopAllSounds();
g_noLogoAnim = 1;

View file

@ -38,8 +38,7 @@ char g_gametypeNames[MAXGAMETYPES][33]
float g_gameUpdateAvgTime = -1.f;
int32_t respawnactortime = 768;
int32_t g_bouncemineRadius = 2500;
int32_t g_deleteQueueSize = 64;
int32_t bouncemineblastradius = 2500;
int32_t respawnitemtime = 768;
int32_t g_morterRadius = 2500;

View file

@ -847,8 +847,8 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &camsprite, sizeof(camsprite), 1 },
{ 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) },
{ 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 },
{ DS_NOCHK, &g_deleteQueueSize, sizeof(g_deleteQueueSize), 1 },
{ DS_CNT(g_deleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_deleteQueueSize },
{ DS_NOCHK, &spriteqamount, sizeof(spriteqamount), 1 },
{ DS_CNT(spriteqamount), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&spriteqamount },
{ DS_NOCHK, &numclouds, sizeof(numclouds), 1 },
{ 0, &clouds[0], sizeof(clouds), 1 },
{ 0, &cloudx, sizeof(cloudx), 1 },