diff --git a/source/sw/CMakeLists.txt b/source/sw/CMakeLists.txt index 4ba66f278..ec32b58b0 100644 --- a/source/sw/CMakeLists.txt +++ b/source/sw/CMakeLists.txt @@ -12,7 +12,6 @@ set( PCH_SOURCES src/coolg.cpp src/coolie.cpp src/copysect.cpp - src/demo.cpp src/draw.cpp src/eel.cpp src/game.cpp diff --git a/source/sw/src/2d.cpp b/source/sw/src/2d.cpp index c39f5da29..0b3d0120d 100644 --- a/source/sw/src/2d.cpp +++ b/source/sw/src/2d.cpp @@ -36,7 +36,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "misc.h" #include "network.h" #include "pal.h" -#include "demo.h" BEGIN_SW_NS @@ -609,7 +608,7 @@ public: twod->ClearScreen(); DrawTexture(twod, tileGetTexture(TITLE_PIC), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE); - MNU_DrawString(160, 170, DemoMode ? GStrings("TXT_LBDEMO") : GStrings("TXT_ENTERING"), 1, 16, 0); + MNU_DrawString(160, 170, /*DemoMode ? GStrings("TXT_LBDEMO") :*/ GStrings("TXT_ENTERING"), 1, 16, 0); MNU_DrawString(160, 180, currentLevel->DisplayName(), 1, 16, 0); // Initiate the level load once the page has been faded in completely. diff --git a/source/sw/src/d_menu.cpp b/source/sw/src/d_menu.cpp index 67a724b21..a6702f4a5 100644 --- a/source/sw/src/d_menu.cpp +++ b/source/sw/src/d_menu.cpp @@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "jsector.h" #include "menus.h" #include "pal.h" -#include "demo.h" #include "keydef.h" #include "gamecontrol.h" @@ -180,12 +179,11 @@ void GameInterface::MenuClosed() } extern SWBOOL InMenuLevel; -extern SWBOOL DemoMode; extern SWBOOL ExitLevel, NewGame; bool GameInterface::CanSave() { - return (!CommEnabled && numplayers ==1 && !DemoMode && !InMenuLevel && !TEST(Player[myconnectindex].Flags, PF_DEAD)); + return (!CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !InMenuLevel && !TEST(Player[myconnectindex].Flags, PF_DEAD)); } void GameInterface::StartGame(FNewGameStartup& gs) @@ -203,10 +201,8 @@ void GameInterface::StartGame(FNewGameStartup& gs) else Level = 1; - DemoPlaying = FALSE; ExitLevel = TRUE; NewGame = TRUE; - DemoMode = FALSE; CameraTestMode = FALSE; Skill = gs.Skill; StopFX(); diff --git a/source/sw/src/demo.cpp b/source/sw/src/demo.cpp deleted file mode 100644 index 455cae427..000000000 --- a/source/sw/src/demo.cpp +++ /dev/null @@ -1,561 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1997, 2005 - 3D Realms Entertainment - -This file is part of Shadow Warrior version 1.2 - -Shadow Warrior is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -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. - -Original Source: 1997 - Frank Maddin and Jim Norwood -Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -#include "ns.h" -//#define MAIN -//#define QUIET -#include "build.h" - - -#include "names2.h" -#include "panel.h" -#include "game.h" -#include "network.h" - -#include "mytypes.h" -#include "gamecontrol.h" -#include "demo.h" - -#include "player.h" -#include "menus.h" - -BEGIN_SW_NS - -DFILE DemoFileIn; -FILE *DemoFileOut; -SWBOOL DemoPlaying = FALSE; -SWBOOL DemoRecording = FALSE; -SWBOOL DemoEdit = FALSE; -SWBOOL DemoMode = FALSE; -SWBOOL DemoModeMenuState = FALSE; -char DemoFileName[16] = "demo.dmo"; -char DemoLevelName[16] = ""; -extern SWBOOL NewGame; - -// Demo sync stuff -FILE *DemoSyncFile; -SWBOOL DemoSyncTest = FALSE, DemoSyncRecord = FALSE; -char DemoTmpName[16] = ""; - -SW_PACKET DemoBuffer[DEMO_BUFFER_MAX]; -int DemoRecCnt = 0; // Can only record 1-player game - -SWBOOL DemoDone; - -void DemoWriteHeader(void); -void DemoReadHeader(void); -void DemoReadBuffer(void); - - -// -// DemoDebug Vars -// - -// DemoDebugMode will close the file after every write -SWBOOL DemoDebugMode = FALSE; -//SWBOOL DemoDebugMode = TRUE; -SWBOOL DemoInitOnce = FALSE; -short DemoDebugBufferMax = 1; - -extern char LevelName[]; -extern uint8_t FakeMultiNumPlayers; -extern SWBOOL QuitFlag; - -/////////////////////////////////////////// -// -// Demo File Manipulation -// -/////////////////////////////////////////// - -char *DemoSyncFileName(void) -{ - static char file_name[32]; - char *ptr; - - strcpy(file_name, DemoFileName); - - if ((ptr = strchr(file_name, '.')) == 0) - strcat(file_name, ".dms"); - else - { - *ptr = '\0'; - strcat(file_name, ".dms"); - } - - return file_name; -} - -void -DemoSetup(void) -{ - if (DemoRecording) - { - if (DemoSyncRecord) - DemoSyncFile = fopen(DemoSyncFileName(),"wb"); - - DemoWriteHeader(); - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); - } - - if (DemoPlaying) - { - if (DemoSyncRecord) - DemoSyncFile = fopen(DemoSyncFileName(),"wb"); - if (DemoSyncTest) - DemoSyncFile = fopen(DemoSyncFileName(),"rb"); - - DemoReadHeader(); - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); - DemoReadBuffer(); - } -} - -void -DemoRecordSetup(void) -{ - if (DemoRecording) - { - if (DemoSyncRecord) - DemoSyncFile = fopen(DemoSyncFileName(),"wb"); - - DemoWriteHeader(); - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); - } -} - -void -DemoPlaySetup(void) -{ - if (DemoPlaying) - { - if (DemoSyncRecord) - DemoSyncFile = fopen(DemoSyncFileName(),"wb"); - if (DemoSyncTest) - DemoSyncFile = fopen(DemoSyncFileName(),"rb"); - - DemoReadHeader(); - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); - DemoReadBuffer(); - } -} - -void -DemoWriteHeader(void) -{ - DEMO_HEADER dh; - DEMO_START_POS dsp; - PLAYERp pp; - - DemoFileOut = fopen(DemoFileName, "wb"); - - if (!DemoFileOut) - return; - - strcpy(dh.map_name, LevelName); - strcpy(dh.LevelSong, ""); - dh.Level = Level; - - if (FakeMultiNumPlayers) - dh.numplayers = FakeMultiNumPlayers; - else - dh.numplayers = numplayers; - - fwrite(&dh, sizeof(dh), 1, DemoFileOut); - - for (pp = Player; pp < Player + dh.numplayers; pp++) - { - dsp.x = pp->posx; - dsp.y = pp->posy; - dsp.z = pp->posz; - fwrite(&dsp, sizeof(dsp), 1, DemoFileOut); - fwrite(&pp->Flags, sizeof(pp->Flags), 1, DemoFileOut); - int16_t ang = fix16_to_int(pp->q16ang); - fwrite(&ang, sizeof(ang), 1, DemoFileOut); - } - - fwrite(&Skill, sizeof(Skill), 1, DemoFileOut); - fwrite(&gNet, sizeof(gNet), 1, DemoFileOut); - - if (DemoDebugMode) - { - DemoDebugBufferMax = numplayers; - fclose(DemoFileOut); - } -} - -void -DemoReadHeader(void) -{ - DEMO_HEADER dh; - DEMO_START_POS dsp; - PLAYERp pp; - -#if DEMO_FILE_TYPE != DEMO_FILE_GROUP - if (DemoEdit) - { - DemoFileIn = fopen(DemoFileName, "rb+"); - } - else -#endif - { - //DemoFileIn = fopen(DemoFileName, "rb"); - DemoFileIn = DOPEN_READ(DemoFileName); - } - - if (DF_ERR(DemoFileIn)) - { - I_Error("File %s is not a valid demo file.",DemoFileName); - } - - DREAD(&dh, sizeof(dh), 1, DemoFileIn); - - strcpy(DemoLevelName, dh.map_name); - Level = dh.Level; - if (dh.numplayers > 1) - { - FakeMultiNumPlayers = dh.numplayers; - } - else - numplayers = dh.numplayers; - - for (pp = Player; pp < Player + dh.numplayers; pp++) - { - DREAD(&dsp, sizeof(dsp), 1, DemoFileIn); - pp->posx = dsp.x; - pp->posy = dsp.y; - pp->posz = dsp.z; - COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); - //pp->cursectnum = 0; - //updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum); - DREAD(&pp->Flags, sizeof(pp->Flags), 1, DemoFileIn); - int16_t ang; - DREAD(&ang, sizeof(ang), 1, DemoFileIn); - pp->q16ang = fix16_from_int(ang); - } - - DREAD(&Skill, sizeof(Skill), 1, DemoFileIn); - DREAD(&gNet, sizeof(gNet), 1, DemoFileIn); -} - -// TODO: Write all data at once -static void -DemoWritePackets(const SW_PACKET *buffer, int32_t count, FILE *f) -{ - OLD_SW_PACKET packet; - for (; count > 0; ++buffer, --count) - { - packet.vel = B_LITTLE16(buffer->vel); - packet.svel = B_LITTLE16(buffer->svel); - packet.angvel = fix16_to_int(buffer->q16angvel); - packet.aimvel = fix16_to_int(buffer->q16aimvel); - packet.bits = B_LITTLE32(buffer->bits); - fwrite(&packet, sizeof(packet), 1, f); - } -} - -// TODO: Read all data at once -static void -DemoReadPackets(SW_PACKET *buffer, int32_t count, DFILE f) -{ - OLD_SW_PACKET packet; - for (; count > 0; ++buffer, --count) - { - DREAD(&packet, sizeof(packet), 1, f); - buffer->vel = B_LITTLE16(packet.vel); - buffer->svel = B_LITTLE16(packet.svel); - buffer->q16angvel = fix16_from_int(packet.angvel); - buffer->q16aimvel = fix16_from_int(packet.aimvel); - buffer->bits = B_LITTLE32(packet.bits); - } -} - -void -DemoDebugWrite(void) -{ - DemoFileOut = fopen(DemoFileName, "ab"); - - ASSERT(DemoFileOut); - - DemoWritePackets(DemoBuffer, DemoDebugBufferMax, DemoFileOut); - memset(DemoBuffer, -1, sizeof(SW_PACKET) * DemoDebugBufferMax); - - fclose(DemoFileOut); -} - -void -DemoWriteBuffer(void) -{ - DemoWritePackets(DemoBuffer, sizeof(DemoBuffer)/sizeof(*DemoBuffer), DemoFileOut); - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); -} - -void -DemoReadBuffer(void) -{ - memset(&DemoBuffer, -1, sizeof(DemoBuffer)); - //DemoReadPackets(DemoBuffer, sizeof(DemoBuffer)/sizeof(*DemoBuffer), DemoFileIn); -} - -void -DemoBackupBuffer(void) -{ -#if DEMO_FILE_TYPE != DEMO_FILE_GROUP - FILE *NewDemoFile; - FILE *OldDemoFile = DemoFileIn; - int pos,i; - char copy_buffer; - char NewDemoFileName[16] = "!"; - - // seek backwards to beginning of last buffer - fseek(OldDemoFile, -sizeof(DemoBuffer)/sizeof(*DemoBuffer)*sizeof(OLD_SW_PACKET), SEEK_CUR); - pos = ftell(OldDemoFile); - - // open a new edit file - strcat(NewDemoFileName, DemoFileName); - NewDemoFile = fopen(NewDemoFileName, "wb"); - - rewind(OldDemoFile); - - // copy old demo to new demo - for (i = 0; i < pos; i++) - { - fread(©_buffer, sizeof(copy_buffer), 1, OldDemoFile); - fwrite(©_buffer,sizeof(copy_buffer), 1, NewDemoFile); - } - - DemoFileOut = NewDemoFile; - fclose(OldDemoFile); -#endif -} - -void -DemoTerm(void) -{ - if (DemoRecording) - { - // if already closed - if (DemoFileOut == NULL) - return; - - if (DemoDebugMode) - { - DemoFileOut = fopen(DemoFileName, "ab"); - ASSERT(DemoFileOut); - } - else - { - // paste on a -1 record to the current buffer - if (DemoRecCnt < DEMO_BUFFER_MAX) - memset(&DemoBuffer[DemoRecCnt], -1, sizeof(DemoBuffer[DemoRecCnt])); - - DemoWriteBuffer(); - } - - // write at least 1 record at the end filled with -1 - // just for good measure - memset(&DemoBuffer[0], -1, sizeof(DemoBuffer[0])); - DemoWritePackets(DemoBuffer, 1, DemoFileOut); - - fclose(DemoFileOut); - DemoFileOut = NULL; - } - - if (DemoPlaying) - { - if (DF_ERR(DemoFileIn)) - return; - - DCLOSE(DemoFileIn); - } - - if (DemoSyncTest||DemoSyncRecord) - { - if (DemoSyncFile == NULL) - return; - - fclose(DemoSyncFile); - DemoSyncFile = NULL; - } -} - -/////////////////////////////////////////// -// -// Demo Play Back -// -/////////////////////////////////////////// - - -void -DemoPlayBack(void) -{ - int pnum, cnt; - static int buf_ndx; - PLAYERp pp; - ControlInfo info; - - // Initialize Game part of network code (When ready2send != 0) - InitNetVars(); - - // IMPORTANT - MUST be right before game loop - InitTimingVars(); - - // THIS STUFF DEPENDS ON MYCONNECTINDEX BEING SET RIGHT - pp = Player + myconnectindex; - - if (!DemoInitOnce) - buf_ndx = 0; - - // everything has been inited at least once for PLAYBACK - DemoInitOnce = TRUE; - - cnt = 0; - ready2send = 0; - DemoDone = FALSE; - - while (TRUE) - { - timerUpdateClock(); - - // makes code run at the same rate - while (totalclock > totalsynctics) - { - handleevents(); - C_RunDelayedCommands(); - - TRAVERSE_CONNECT(pnum) - { - pp = Player + pnum; - pp->inputfifo[pp->movefifoend & (MOVEFIFOSIZ-1)] = DemoBuffer[buf_ndx]; - pp->movefifoend++; - buf_ndx++; - - if (pp->inputfifo[(pp->movefifoend - 1) & (MOVEFIFOSIZ-1)].bits == -1) - { - DemoDone = TRUE; - break; - } - - if (buf_ndx > DEMO_BUFFER_MAX - 1) - { - DemoReadBuffer(); - buf_ndx = 0; - } - } - - if (DemoDone) - break; - - cnt++; - - CONTROL_GetInput(&info); - - domovethings(); - - if (buttonMap.ButtonDown(gamefunc_See_Coop_View)) - { - buttonMap.ClearButton(gamefunc_See_Coop_View); - - screenpeek = connectpoint2[screenpeek]; - - if (screenpeek < 0) - screenpeek = connecthead; - } - - if (DemoSyncRecord) - demosync_record(); - if (DemoSyncTest) - demosync_test(cnt); - } - - // Put this back in later when keyboard stuff is stable - if (DemoEdit) - { - //CONTROL_GetButtonInput(); - CONTROL_GetInput(&info); - - // if a key is pressed, start recording from the point the key - // was pressed - if (buttonMap.ButtonDown(gamefunc_Move_Forward) || - buttonMap.ButtonDown(gamefunc_Move_Backward) || - buttonMap.ButtonDown(gamefunc_Turn_Left) || - buttonMap.ButtonDown(gamefunc_Turn_Right) || - buttonMap.ButtonDown(gamefunc_Fire) || - buttonMap.ButtonDown(gamefunc_Open) || - buttonMap.ButtonDown(gamefunc_Jump) || - buttonMap.ButtonDown(gamefunc_Crouch) || - buttonMap.ButtonDown(gamefunc_Look_Up) || - buttonMap.ButtonDown(gamefunc_Look_Down)) - { - DemoBackupBuffer(); - - DemoRecCnt = buf_ndx; - DemoPlaying = FALSE; - DemoRecording = TRUE; - return; - } - } - - if (buttonMap.ButtonDown(gamefunc_See_Coop_View)) - { - screenpeek += 1; - if (screenpeek > numplayers-1) - screenpeek = 0; - } - - // demo is over - if (DemoDone) - break; - - if (QuitFlag) - { - DemoMode = FALSE; - break; - } - - if (ExitLevel) - { - // Quiting Demo - ExitLevel = FALSE; - if (DemoMode) - { - DemoPlaying = FALSE; - DemoMode = FALSE; - } - break; - } - - drawscreen(Player + screenpeek); - } - - // only exit if conditions are write - if (DemoDone && !DemoMode && !NewGame) - { - TerminateLevel(); - TerminateGame(); - } - -} -END_SW_NS diff --git a/source/sw/src/demo.h b/source/sw/src/demo.h deleted file mode 100644 index 40588d1e0..000000000 --- a/source/sw/src/demo.h +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1997, 2005 - 3D Realms Entertainment - -This file is part of Shadow Warrior version 1.2 - -Shadow Warrior is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -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. - -Original Source: 1997 - Frank Maddin and Jim Norwood -Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- -BEGIN_SW_NS - -extern FILE *DemoFile; -extern SWBOOL DemoPlaying; -extern SWBOOL DemoRecording; -extern SWBOOL DemoEdit; -extern SWBOOL DemoMode; -extern char DemoFileName[16]; -extern char DemoLevelName[16]; - -extern FILE *DemoSyncFile; -extern SWBOOL DemoSyncTest; -extern SWBOOL DemoSyncRecord; -extern char DemoTmpName[16]; - -extern SWBOOL DemoDebugMode; -extern SWBOOL DemoInitOnce; -extern short DemoDebugBufferMax; - -#define DEMO_BUFFER_MAX 2048 -extern SW_PACKET DemoBuffer[DEMO_BUFFER_MAX]; -extern int DemoRecCnt; // Can only record 1-player game - -#define DEMO_FILE_GROUP 0 -#define DEMO_FILE_STD 1 -#define DEMO_FILE_TYPE DEMO_FILE_GROUP - -// Demo File - reading from group -#if DEMO_FILE_TYPE == DEMO_FILE_GROUP -typedef FileReader DFILE; -#define DREAD(ptr, size, num, handle) (handle).Read((ptr),(size)*(num)) -#define DOPEN_READ(name) fileSystem.OpenFileReader(name) -#define DCLOSE(handle) ((handle).Close()) -#define DF_ERR(f) (!(f).isOpen()) -#else -typedef FILE *DFILE; -#define DREAD(ptr, size, num,handle) fread((ptr),(size),(num),(handle)) -#define DWRITE(ptr, size, num,handle) fwrite((ptr),(size),(num),(handle)) -#define DOPEN_WRITE(name) fopen(name,"wb") -#define DOPEN_READ(name) fopen(name,"rb") -#define DCLOSE(handle) fclose(handle) -#define DF_ERR(f) ((f) == NULL) -#endif - -void DemoTerm(void); -void DemoPlaySetup(void); -void DemoPlayBack(void); -void DemoRecordSetup(void); -void DemoDebugWrite(void); -void DemoWriteBuffer(void); -END_SW_NS diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 0334678c2..415d0f113 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1441,9 +1441,9 @@ void DrawCheckKeys(PLAYERp pp) void DrawCrosshair(PLAYERp pp) { - extern SWBOOL DemoMode,CameraTestMode; + extern SWBOOL CameraTestMode; - if (cl_crosshair && !(DemoMode || CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) && dimensionmode != 6) + if (cl_crosshair && !(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) && dimensionmode != 6) { int32_t a = 2326; @@ -1809,7 +1809,7 @@ void MoveScrollMode2D(PLAYERp pp); void drawscreen(PLAYERp pp) { - extern SWBOOL DemoMode,CameraTestMode; + extern SWBOOL CameraTestMode; int tx, ty, tz; fix16_t tq16horiz, tq16ang; short tsectnum; @@ -1951,7 +1951,7 @@ drawscreen(PLAYERp pp) { bob_amt = camerapp->bob_amt; - if (DemoMode || CameraTestMode) + if (CameraTestMode) { CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tq16ang, &tq16horiz); } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index bdaf8a07e..cf30ac140 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -55,9 +55,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "gamecontrol.h" #include "gamedefs.h" -#include "demo.h" #include "misc.h" -//#include "exports.h" #include "misc.h" #include "break.h" @@ -133,7 +131,6 @@ SWBOOL GraphicsMode = FALSE; char CacheLastLevel[32] = ""; char PlayerNameArg[32] = ""; SWBOOL CleanExit = FALSE; -SWBOOL DemoModeMenuInit = FALSE; SWBOOL FinishAnim = 0; SWBOOL ShortGameMode = FALSE; SWBOOL ReloadPrompt = FALSE; @@ -319,8 +316,6 @@ Distance(int x1, int y1, int x2, int y2) void TerminateGame(void) { - DemoTerm(); - ErrorCorrectionQuit(); // uninitmultiplayers(); @@ -484,7 +479,6 @@ bool InitGame() videoInit(); - DemoModeMenuInit = TRUE; // precache as much stuff as you can if (UserMapName[0] == '\0') { @@ -581,7 +575,7 @@ void InitLevelGlobals(void) zillawasseen = FALSE; memset(BossSpriteNum,-1,sizeof(BossSpriteNum)); - PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode); + PedanticMode = false; } void InitLevelGlobals2(void) @@ -611,39 +605,9 @@ InitLevel(void) // A few IMPORTANT GLOBAL RESETS InitLevelGlobals(); - if (!DemoMode) - Mus_Stop(); + Mus_Stop(); InitLevelGlobals2(); - if (DemoMode) - { - Level = 0; - NewGame = TRUE; - DemoInitOnce = FALSE; - strcpy(DemoFileName, DemoName[DemoNumber]); - DemoNumber++; - if (!DemoName[DemoNumber][0]) - DemoNumber = 0; - - // read header and such - DemoPlaySetup(); - - strcpy(LevelName, DemoLevelName); - - FindLevelInfo(LevelName, &Level); - if (Level > 0) - { - strcpy(LevelName, mapList[Level].fileName); - UserMapName[0] = '\0'; - } - else - { - strcpy(UserMapName, DemoLevelName); - Level = 0; - } - - } - else { if (Level < 0) Level = 0; @@ -651,16 +615,6 @@ InitLevel(void) if (Level > MAX_LEVELS) Level = 1; - // extra code in case something is resetting these values - if (NewGame) - { - //Level = 1; - //DemoPlaying = FALSE; - DemoMode = FALSE; - //DemoRecording = FALSE; - //DemoEdit = FALSE; - } - if (UserMapName[0]) { strcpy(LevelName, UserMapName); @@ -684,10 +638,6 @@ InitLevel(void) if (NewGame) InitNewGame(); - //LoadingLevelScreen(); - if (!DemoMode && !DemoInitOnce) - DemoPlaySetup(); - if (!LoadLevel(LevelName)) { NewGame = false; @@ -758,10 +708,6 @@ TerminateLevel(void) int i, nexti, stat, pnum, ndx; SECT_USERp *sectu; -//HEAP_CHECK(); - - DemoTerm(); - // Free any track points for (ndx = 0; ndx < MAX_TRACKS; ndx++) { @@ -854,48 +800,23 @@ TerminateLevel(void) void NewLevel(void) { - if (DemoPlaying) + do { InitLevel(); - InitRunLevel(); - - DemoInitOnce = FALSE; - if (DemoMode) - { - if (DemoModeMenuInit) - { - DemoModeMenuInit = FALSE; - inputState.ClearKeyStatus(sc_Escape); - } - } - - DemoPlayBack(); - - if (DemoRecording && DemoEdit) - { - RunLevel(); - } + RunLevel(); } - else + while (LoadGameOutsideMoveLoop); + STAT_Update(false); + + if (!QuitFlag) { - do - { - InitLevel(); - RunLevel(); - } - while (LoadGameOutsideMoveLoop); - STAT_Update(false); - - if (!QuitFlag) - { - // for good measure do this - ready2send = 0; - waitforeverybody(); - } - - StatScreen(&Player[myconnectindex]); + // for good measure do this + ready2send = 0; + waitforeverybody(); } + StatScreen(&Player[myconnectindex]); + if (LoadGameFromDemo) LoadGameFromDemo = FALSE; else @@ -948,20 +869,6 @@ void MenuLevel(void) M_StartControlPanel(false); M_SetMenu(NAME_Mainmenu); - // do demos only if not playing multi play - if (!CommEnabled && numplayers <= 1 && !FinishAnim && !NoDemoStartup) - { - // demos exist - do demo instead - if (DemoName[0][0] != '\0') - { - DemoMode = TRUE; - DemoPlaying = TRUE; - return; - } - } - - DemoMode = FALSE; - DemoPlaying = FALSE; twod->ClearScreen(); videoNextPage(); @@ -1141,7 +1048,7 @@ void StatScreen(PLAYERp mpp) void GameIntro(void) { - if (DemoPlaying || (!CommEnabled && UserMapName[0])) + if ((!CommEnabled && UserMapName[0])) return; Level = 1; @@ -1236,11 +1143,6 @@ void InitPlayerGameSettings(void) { int pnum; - // don't jack with auto aim settings if DemoMode is going - // what the hell did I do this for????????? - //if (DemoMode) - // return; - if (CommEnabled) { // everyone gets the same Auto Aim @@ -1264,9 +1166,6 @@ void InitPlayerGameSettings(void) void InitRunLevel(void) { - if (DemoEdit) - return; - if (LoadGameOutsideMoveLoop) { int SavePlayClock; @@ -1321,12 +1220,6 @@ void InitRunLevel(void) InitPrediction(&Player[myconnectindex]); - if (!DemoInitOnce) - DemoRecordSetup(); - - // everything has been inited at least once for RECORD - DemoInitOnce = TRUE; - waitforeverybody(); CheckVersion(GameVersion); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index b535eb3a8..78324d38a 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2293,8 +2293,6 @@ void DebugWriteString(char *string); // game.c void ManualPlayerInsert(PLAYERp pp); // game.c void initsynccrc(void); // sync.c -void demosync_record(void); // sync.c -void demosync_test(int cnt); // sync.c void getsyncstat(void); // sync.c void SyncStatMessage(void); // sync.c diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 3e7fe192f..9c2b8ad4c 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -38,7 +38,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "jsector.h" #include "menus.h" #include "pal.h" -#include "demo.h" #include "keydef.h" @@ -64,7 +63,7 @@ short TimeLimitTable[9] = {0,3,5,10,15,20,30,45,60}; SWBOOL MNU_StartNetGame(void) { - extern SWBOOL ExitLevel, ShortGameMode, DemoInitOnce, FirstTimeIntoGame; + extern SWBOOL ExitLevel, ShortGameMode, FirstTimeIntoGame; extern short Level, Skill; // CTW REMOVED //extern int gTenActivated; @@ -77,11 +76,9 @@ MNU_StartNetGame(void) // Skill can go negative here Skill = gs.NetMonsters - 1; Level = gs.NetLevel + 1; - DemoPlaying = FALSE; ExitLevel = TRUE; NewGame = TRUE; // restart demo for multi-play mode - DemoInitOnce = FALSE; // TENSW: return if a joiner if (/* CTW REMOVED gTenActivated && */ !AutoNet && FirstTimeIntoGame) diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 91a80093a..f97df204e 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -36,7 +36,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "names2.h" #include "network.h" #include "pal.h" -#include "demo.h" #include "weapon.h" #include "menus.h" @@ -389,9 +388,6 @@ ResumeGame(void) if (paused) return; - if (DemoPlaying || DemoRecording) - return; - if (numplayers < 2) paused = 0; } @@ -1341,7 +1337,7 @@ getpackets(void) case PACKET_TYPE_NEW_GAME: { - extern SWBOOL NewGame, ShortGameMode, DemoInitOnce; + extern SWBOOL NewGame, ShortGameMode; PACKET_NEW_GAMEp p; extern short TimeLimitTable[]; @@ -1389,21 +1385,10 @@ getpackets(void) ExitLevel = TRUE; NewGame = TRUE; // restart demo for multi-play mode - DemoInitOnce = FALSE; - - // send a dummy packet to see when it arrives - //tempbuf[0] = PACKET_TYPE_DUMMY; - //sendpacket(otherconnectindex, tempbuf, 1); - - ////DSPRINTF(ds,"Level %d, Skill %d, AutoAim %d",Level, Skill, cl_autoaim); - //MONO_PRINT(ds); - break; } case PACKET_TYPE_DUMMY: - ////DSPRINTF(ds,"Got Dummy Packet!!!"); - //MONO_PRINT(ds); break; case PACKET_TYPE_VERSION: diff --git a/source/sw/src/osdcmds.cpp b/source/sw/src/osdcmds.cpp index 2f6963446..e3bab0e1b 100644 --- a/source/sw/src/osdcmds.cpp +++ b/source/sw/src/osdcmds.cpp @@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "printf.h" #include "misc.h" -#include "demo.h" // g_firstDemoFile[] #include "menus.h" #include "mapinfo.h" #include "jsector.h" diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 9c8c5f765..272fddb53 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -42,7 +42,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "menus.h" #include "network.h" #include "pal.h" -#include "demo.h" #include "mclip.h" #include "sprite.h" @@ -6662,7 +6661,6 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) { SPRITEp sp = pp->SpriteP; USERp u = User[pp->PlayerSprite]; - extern SWBOOL DemoMode,DemoDone; //if (TEST_SYNC_KEY(pp, SK_OPERATE)) if (TEST_SYNC_KEY(pp, SK_SPACE_BAR)) @@ -6734,11 +6732,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) } else { - // restart the level in single play - if (DemoMode) - DemoDone = TRUE; - else - ExitLevel = TRUE; + ExitLevel = TRUE; } DoPlayerFireOutDeath(pp); @@ -7678,38 +7672,6 @@ domovethings(void) // for things like sync testing MoveThingsCount++; - //RTS_Keys(); - - // recording is done here - if (DemoRecording) - { - TRAVERSE_CONNECT(i) - { - pp = Player + i; - - DemoBuffer[DemoRecCnt] = pp->input; - - if (DemoDebugMode) - { - DemoRecCnt++; - if (DemoRecCnt > DemoDebugBufferMax-1) - { - DemoDebugWrite(); - DemoRecCnt = 0; - } - } - else - { - DemoRecCnt++; - if (DemoRecCnt > DEMO_BUFFER_MAX-1) - { - DemoWriteBuffer(); - DemoRecCnt = 0; - } - } - } - } - totalsynctics += synctics; updateinterpolations(); // Stick at beginning of domovethings @@ -7825,10 +7787,6 @@ domovethings(void) FinishedLevel = TRUE; } } - - - //if (DemoSyncRecord && !DemoPlaying) - // demosync_record(); } diff --git a/source/sw/src/sync.cpp b/source/sw/src/sync.cpp index 0e58c283f..adbd040cb 100644 --- a/source/sw/src/sync.cpp +++ b/source/sw/src/sync.cpp @@ -137,33 +137,6 @@ EnemySync(void) updatecrc(crc, (spr->ang) & 255); } -#if 0 - extern char DemoTmpName[]; - //DSPRINTF(ds, "Demo Tmp Name %s", DemoTmpName); - MONO_PRINT(ds); - - { - if (Once < 1 && DemoTmpName[0] != '\0') - { - FILE *fout; - - Once++; - fout = fopen(DemoTmpName, "wb"); - - //DSPRINTF(ds, "Demo Tmp Name %s", DemoTmpName); - MONO_PRINT(ds); - - TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], j, nextj) - { - spr = &sprite[j]; - - fprintf(fout, "num %d, spr->x %d, spr->y %d, spr->z %d, spr->ang %d, spr->picnum %d\n", j, spr->x, spr->y, spr->z, spr->ang, spr->picnum); - } - fclose(fout); - } - } -#endif - return (uint8_t) crc & 255; } @@ -481,74 +454,6 @@ GetSyncInfoFromPacket(uint8_t *packbuf, int packbufleng, int *j, int otherconnec } -//////////////////////////////////////////////////////////////////////// -// -// Demo Sync recording and testing -// -//////////////////////////////////////////////////////////////////////// - -extern FILE *DemoSyncFile; - -void -demosync_record(void) -{ - int i; - uint8_t sync_val; - - for (i = 0; SyncFunc[i]; i++) - { - sync_val = (*SyncFunc[i])(); - fwrite(&sync_val, sizeof(sync_val), 1, DemoSyncFile); - } -} - -void -demosync_test(int cnt) -{ - int i; - uint8_t sync_val; - - for (i = 0; SyncFunc[i]; i++) - { - fread(&sync_val, sizeof(sync_val), 1, DemoSyncFile); - - if (sync_val != (*SyncFunc[i])()) - { - TerminateLevel(); - I_Error("Demo out of sync - Sync Byte Number %d - Iteration %d.", i, cnt); - } - } -} - - - -/* -getsyncbyte() - { - int i, j; - char ch; - SPRITEp spr; - PLAYERp pp; - USERp u; - - ch = (char) (randomseed & 255); - - for (i = connecthead; i >= 0; i = connectpoint2[i]) - { - pp = Player + i; - u = User[pp->SpriteP - sprite]; - ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ fix16_to_int(pp->q16ang) ^ fix16_to_int(pp->q16horiz) ^ u->Health); - } - - for (j = headspritestat[STAT_ENEMY]; j >= 0; j = nextspritestat[j]) - { - spr = &sprite[j]; - ch ^= spr->x ^ spr->y ^ spr->z ^ spr->ang; - } - - return (ch); - } -*/ #endif END_SW_NS