mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-02 14:40:40 +00:00
- cleaned out demo code.
This commit is contained in:
parent
d13b2dc130
commit
f5d363d914
8 changed files with 45 additions and 142 deletions
|
@ -1,49 +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.
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef demo_h_
|
|
||||||
#define demo_h_
|
|
||||||
|
|
||||||
#include "compat.h"
|
|
||||||
#include "files.h"
|
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
|
||||||
|
|
||||||
|
|
||||||
#define DEMOFN_FMT "edemo%03d.edm"
|
|
||||||
#define LDEMOFN_FMT "demo%d.dmo"
|
|
||||||
#define MAXDEMOS 1000
|
|
||||||
|
|
||||||
extern FileWriter * g_demo_filePtr;
|
|
||||||
extern char g_firstDemoFile[BMAX_PATH];
|
|
||||||
|
|
||||||
extern int32_t g_demo_cnt;
|
|
||||||
extern int32_t g_demo_goalCnt;
|
|
||||||
extern int32_t g_demo_paused;
|
|
||||||
extern FileReader g_demo_recFilePtr;
|
|
||||||
extern int32_t g_demo_rewind;
|
|
||||||
extern int32_t g_demo_showStats;
|
|
||||||
extern int32_t g_demo_totalCnt;
|
|
||||||
|
|
||||||
END_DUKE_NS
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -29,7 +29,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "demo.h"
|
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#include "baselayer.h"
|
#include "baselayer.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "demo.h"
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
|
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
|
@ -30,29 +29,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
char g_firstDemoFile[BMAX_PATH];
|
|
||||||
|
|
||||||
FileWriter *g_demo_filePtr{}; // write
|
|
||||||
FileReader g_demo_recFilePtr; // read
|
|
||||||
|
|
||||||
int32_t g_demo_cnt;
|
|
||||||
int32_t g_demo_goalCnt=0;
|
|
||||||
int32_t g_demo_totalCnt;
|
|
||||||
int32_t g_demo_paused=0;
|
|
||||||
int32_t g_demo_rewind=0;
|
|
||||||
int32_t g_demo_showStats=1;
|
|
||||||
|
|
||||||
int32_t demoplay_diffs=1;
|
|
||||||
int32_t demorec_seeds_cvar=1;
|
|
||||||
int32_t demoplay_showsync=1;
|
|
||||||
|
|
||||||
static int32_t demorec_seeds=1, demo_hasseeds;
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
int32_t G_PlaybackDemo(void)
|
int32_t G_PlaybackDemo(void)
|
||||||
{
|
{
|
||||||
int32_t bigi, initsyncofs = 0, lastsyncofs = 0, lastsynctic = 0, lastsyncclock = 0;
|
|
||||||
int32_t foundemo = 0, outofsync=0;
|
int32_t foundemo = 0, outofsync=0;
|
||||||
static int32_t in_menu = 0;
|
static int32_t in_menu = 0;
|
||||||
|
|
||||||
|
@ -63,71 +44,57 @@ int32_t G_PlaybackDemo(void)
|
||||||
if (ready2send)
|
if (ready2send)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RECHECK:
|
while (int in_menu = g_player[myconnectindex].ps->gm & MODE_MENU)
|
||||||
in_menu = g_player[myconnectindex].ps->gm&MODE_MENU;
|
|
||||||
|
|
||||||
pub = NUMPAGES;
|
|
||||||
pus = NUMPAGES;
|
|
||||||
|
|
||||||
renderFlushPerms();
|
|
||||||
|
|
||||||
if (foundemo == 0)
|
|
||||||
{
|
{
|
||||||
ud.recstat = 0;
|
if (foundemo == 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;
|
|
||||||
bigi = 0;
|
|
||||||
|
|
||||||
inputState.ClearAllInput();
|
|
||||||
|
|
||||||
while (g_demo_cnt < g_demo_totalCnt || foundemo==0)
|
|
||||||
{
|
|
||||||
// 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();
|
||||||
goto RECHECK;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (g_player[myconnectindex].ps->gm&MODE_TYPE)
|
else if (g_player[myconnectindex].ps->gm & MODE_TYPE)
|
||||||
{
|
{
|
||||||
Net_SendMessage();
|
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;
|
||||||
|
@ -140,31 +107,22 @@ RECHECK:
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
G_HandleAsync();
|
ud.multimode = numplayers; // fixes 2 infinite loops after watching demo
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "osdcmds.h"
|
#include "osdcmds.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
#include "demo.h"
|
|
||||||
|
|
||||||
#include "cheats.h"
|
#include "cheats.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "cheats.h"
|
#include "cheats.h"
|
||||||
#include "demo.h" // g_firstDemoFile[]
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "osdcmds.h"
|
#include "osdcmds.h"
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "demo.h"
|
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "gamevar.h"
|
#include "gamevar.h"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "demo.h"
|
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
#include "statistics.h"
|
#include "statistics.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
|
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "demo.h"
|
|
||||||
#include "mdsprite.h"
|
#include "mdsprite.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
@ -318,7 +317,7 @@ void G_DisplayRest(int32_t smoothratio)
|
||||||
if (ud.pause_on == 1 && (g_player[myconnectindex].ps->gm & MODE_MENU) == 0)
|
if (ud.pause_on == 1 && (g_player[myconnectindex].ps->gm & MODE_MENU) == 0)
|
||||||
fi.PrintPaused();
|
fi.PrintPaused();
|
||||||
|
|
||||||
mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
mdpause = (ud.pause_on || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||||
|
|
||||||
Net_DisplaySyncMsg();
|
Net_DisplaySyncMsg();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue