2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** g_level.cpp
|
2009-02-03 19:11:43 +00:00
|
|
|
** controls movement between levels
|
2006-02-24 04:48:15 +00:00
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2006-06-11 01:37:00 +00:00
|
|
|
** Copyright 1998-2006 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include "templates.h"
|
|
|
|
#include "d_main.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "g_game.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "d_event.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "wi_stuff.h"
|
|
|
|
#include "r_data.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "am_map.h"
|
|
|
|
#include "c_dispatch.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "p_setup.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "r_sky.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "f_finale.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "st_stuff.h"
|
|
|
|
#include "hu_stuff.h"
|
|
|
|
#include "p_saveg.h"
|
|
|
|
#include "p_acs.h"
|
|
|
|
#include "d_protocol.h"
|
|
|
|
#include "v_text.h"
|
|
|
|
#include "s_sndseq.h"
|
|
|
|
#include "b_bot.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "a_lightning.h"
|
|
|
|
#include "m_png.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "version.h"
|
|
|
|
#include "m_menu.h"
|
|
|
|
#include "statnums.h"
|
2007-12-20 22:35:02 +00:00
|
|
|
#include "sbarinfo.h"
|
2007-12-26 16:06:03 +00:00
|
|
|
#include "r_translate.h"
|
2008-03-19 12:48:02 +00:00
|
|
|
#include "p_lnspec.h"
|
2008-06-11 12:17:45 +00:00
|
|
|
#include "r_interpolate.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "d_net.h"
|
2008-09-15 00:47:31 +00:00
|
|
|
#include "d_netinf.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#include "gi.h"
|
|
|
|
|
2006-04-11 16:27:41 +00:00
|
|
|
#include "g_hub.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
EXTERN_CVAR (Float, sv_gravity)
|
|
|
|
EXTERN_CVAR (Float, sv_aircontrol)
|
|
|
|
EXTERN_CVAR (Int, disableautosave)
|
|
|
|
|
|
|
|
#define SNAP_ID MAKE_ID('s','n','A','p')
|
2006-06-14 15:56:56 +00:00
|
|
|
#define DSNP_ID MAKE_ID('d','s','N','p')
|
2006-02-24 04:48:15 +00:00
|
|
|
#define VIST_ID MAKE_ID('v','i','S','t')
|
|
|
|
#define ACSD_ID MAKE_ID('a','c','S','d')
|
|
|
|
#define RCLS_ID MAKE_ID('r','c','L','s')
|
|
|
|
#define PCLS_ID MAKE_ID('p','c','L','s')
|
|
|
|
|
|
|
|
static void SetEndSequence (char *nextmap, int type);
|
2009-02-03 19:11:43 +00:00
|
|
|
void G_VerifySkill();
|
2008-06-22 09:13:19 +00:00
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static FRandom pr_classchoice ("RandomPlayerClassChoice");
|
|
|
|
|
|
|
|
TArray<EndSequence> EndSequences;
|
|
|
|
|
2008-06-05 04:30:18 +00:00
|
|
|
EndSequence::EndSequence()
|
|
|
|
{
|
|
|
|
EndType = END_Pic;
|
|
|
|
Advanced = false;
|
|
|
|
MusicLooping = false;
|
|
|
|
PlayTheEnd = false;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
extern level_info_t TheDefaultLevelInfo;
|
2006-09-14 00:02:31 +00:00
|
|
|
extern bool timingdemo;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Start time for timing demos
|
|
|
|
int starttime;
|
|
|
|
|
|
|
|
|
2006-04-16 19:09:36 +00:00
|
|
|
extern bool netdemo;
|
2006-05-03 22:45:01 +00:00
|
|
|
extern FString BackupSaveName;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-18 04:25:26 +00:00
|
|
|
bool savegamerestore;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern int mousex, mousey;
|
|
|
|
extern bool sendpause, sendsave, sendturn180, SendLand;
|
|
|
|
extern const AInventory *SendItemUse, *SendItemDrop;
|
|
|
|
|
|
|
|
void *statcopy; // for statistics driver
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
FLevelLocals level; // info about current level
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
//
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
int FindEndSequence (int type, const char *picname)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
unsigned int i, num;
|
|
|
|
|
|
|
|
num = EndSequences.Size ();
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2008-05-30 06:56:50 +00:00
|
|
|
if (EndSequences[i].EndType == type && !EndSequences[i].Advanced &&
|
2006-02-24 04:48:15 +00:00
|
|
|
(type != END_Pic || stricmp (EndSequences[i].PicName, picname) == 0))
|
|
|
|
{
|
|
|
|
return (int)i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void SetEndSequence (char *nextmap, int type)
|
|
|
|
{
|
|
|
|
int seqnum;
|
|
|
|
|
|
|
|
seqnum = FindEndSequence (type, NULL);
|
|
|
|
if (seqnum == -1)
|
|
|
|
{
|
|
|
|
EndSequence newseq;
|
|
|
|
newseq.EndType = type;
|
|
|
|
seqnum = (int)EndSequences.Push (newseq);
|
|
|
|
}
|
2009-08-30 10:43:51 +00:00
|
|
|
mysnprintf(nextmap, sizeof(nextmap), "enDSeQ%04x", (WORD)seqnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_SetForEndGame (char *nextmap)
|
|
|
|
{
|
|
|
|
if (!strncmp(nextmap, "enDSeQ",6)) return; // If there is already an end sequence please leave it alone!!!
|
|
|
|
|
|
|
|
if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
|
|
|
SetEndSequence (nextmap, gameinfo.flags & GI_SHAREWARE ? END_BuyStrife : END_Strife);
|
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Hexen)
|
|
|
|
{
|
|
|
|
SetEndSequence (nextmap, END_Chess);
|
|
|
|
}
|
2009-03-22 11:37:56 +00:00
|
|
|
else if (gameinfo.gametype == GAME_Doom && (gameinfo.flags & GI_MAPxx))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
SetEndSequence (nextmap, END_Cast);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // The ExMx games actually have different ends based on the episode,
|
|
|
|
// but I want to keep this simple.
|
|
|
|
SetEndSequence (nextmap, END_Pic1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// G_InitNew
|
|
|
|
// Can be called by the startup code or the menu task,
|
|
|
|
// consoleplayer, playeringame[] should be set.
|
|
|
|
//
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
static FString d_mapname;
|
2007-09-02 09:57:08 +00:00
|
|
|
static int d_skill=-1;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-08-09 08:42:15 +00:00
|
|
|
void G_DeferedInitNew (const char *mapname, int newskill)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
d_mapname = mapname;
|
2007-08-09 08:42:15 +00:00
|
|
|
d_skill = newskill;
|
2006-02-24 04:48:15 +00:00
|
|
|
CheckWarpTransMap (d_mapname, true);
|
|
|
|
gameaction = ga_newgame2;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (map)
|
|
|
|
{
|
|
|
|
if (netgame)
|
|
|
|
{
|
|
|
|
Printf ("Use "TEXTCOLOR_BOLD"changemap"TEXTCOLOR_NORMAL" instead. "TEXTCOLOR_BOLD"Map"
|
|
|
|
TEXTCOLOR_NORMAL" is for single-player only.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
2008-04-05 12:14:33 +00:00
|
|
|
if (!P_CheckMapData(argv[1]))
|
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
Printf ("No map %s\n", argv[1]);
|
2008-04-05 12:14:33 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
G_DeferedInitNew (argv[1]);
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: map <map name>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
CCMD (open)
|
|
|
|
{
|
|
|
|
if (netgame)
|
|
|
|
{
|
|
|
|
Printf ("You cannot use open in multiplayer games.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
d_mapname = "file:";
|
|
|
|
d_mapname += argv[1];
|
2008-04-05 12:14:33 +00:00
|
|
|
if (!P_CheckMapData(d_mapname))
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
Printf ("No map %s\n", d_mapname.GetChars());
|
2008-04-05 12:14:33 +00:00
|
|
|
}
|
2006-06-14 15:56:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gameaction = ga_newgame2;
|
2007-08-09 08:42:15 +00:00
|
|
|
d_skill = -1;
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: open <map file>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_NewInit ()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
G_ClearSnapshots ();
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
netgame = false;
|
|
|
|
netdemo = false;
|
|
|
|
multiplayer = false;
|
|
|
|
if (demoplayback)
|
|
|
|
{
|
|
|
|
C_RestoreCVars ();
|
|
|
|
demoplayback = false;
|
|
|
|
D_SetupUserInfo ();
|
|
|
|
}
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
player_t *p = &players[i];
|
2006-07-02 21:58:10 +00:00
|
|
|
userinfo_t saved_ui = players[i].userinfo;
|
2006-09-01 01:52:50 +00:00
|
|
|
int chasecam = p->cheats & CF_CHASECAM;
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
p->~player_t();
|
|
|
|
::new(p) player_t;
|
2006-09-01 01:52:50 +00:00
|
|
|
players[i].cheats |= chasecam;
|
2006-02-24 04:48:15 +00:00
|
|
|
players[i].playerstate = PST_DEAD;
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
playeringame[i] = 0;
|
2006-07-02 21:58:10 +00:00
|
|
|
players[i].userinfo = saved_ui;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
BackupSaveName = "";
|
|
|
|
consoleplayer = 0;
|
|
|
|
NextSkill = -1;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_DoNewGame (void)
|
|
|
|
{
|
|
|
|
G_NewInit ();
|
|
|
|
playeringame[consoleplayer] = 1;
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
if (d_skill != -1)
|
|
|
|
{
|
|
|
|
gameskill = d_skill;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
G_InitNew (d_mapname, false);
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Initializes player classes in case they are random.
|
|
|
|
// This gets called at the start of a new game, and the classes
|
|
|
|
// chosen here are used for the remainder of a single-player
|
|
|
|
// or coop game. These are ignored for deathmatch.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
static void InitPlayerClasses ()
|
|
|
|
{
|
|
|
|
if (!savegamerestore)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
SinglePlayerClass[i] = players[i].userinfo.PlayerClass;
|
|
|
|
if (SinglePlayerClass[i] < 0 || !playeringame[i])
|
|
|
|
{
|
|
|
|
SinglePlayerClass[i] = (pr_classchoice()) % PlayerClasses.Size ();
|
|
|
|
}
|
|
|
|
players[i].cls = NULL;
|
|
|
|
players[i].CurrentPlayerClass = SinglePlayerClass[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-12-29 03:38:37 +00:00
|
|
|
void G_InitNew (const char *mapname, bool bTitleLevel)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
EGameSpeed oldSpeed;
|
|
|
|
bool wantFast;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!savegamerestore)
|
2006-09-23 20:14:06 +00:00
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
G_ClearSnapshots ();
|
2006-09-23 20:14:06 +00:00
|
|
|
P_RemoveDefereds ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-09-23 20:14:06 +00:00
|
|
|
// [RH] Mark all levels as not visited
|
2006-05-04 06:14:52 +00:00
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
wadlevelinfos[i].flags = wadlevelinfos[i].flags & ~LEVEL_VISITED;
|
|
|
|
}
|
|
|
|
|
|
|
|
UnlatchCVars ();
|
2007-11-02 22:03:03 +00:00
|
|
|
G_VerifySkill();
|
2006-02-24 04:48:15 +00:00
|
|
|
UnlatchCVars ();
|
|
|
|
|
|
|
|
if (paused)
|
|
|
|
{
|
|
|
|
paused = 0;
|
2009-05-20 02:52:07 +00:00
|
|
|
S_ResumeSound (false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (StatusBar != NULL)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
StatusBar->Destroy();
|
2008-01-16 14:44:27 +00:00
|
|
|
StatusBar = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (bTitleLevel)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
StatusBar = new DBaseStatusBar (0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-12-06 10:22:37 +00:00
|
|
|
else if (SBarInfoScript[SCRIPT_CUSTOM] != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-06 10:22:37 +00:00
|
|
|
int cstype = SBarInfoScript[SCRIPT_CUSTOM]->GetGameType();
|
2008-01-16 04:43:50 +00:00
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
//Did the user specify a "base"
|
|
|
|
if(cstype == GAME_Heretic)
|
2008-02-09 03:55:41 +00:00
|
|
|
{
|
|
|
|
StatusBar = CreateHereticStatusBar();
|
|
|
|
}
|
|
|
|
else if(cstype == GAME_Hexen)
|
|
|
|
{
|
|
|
|
StatusBar = CreateHexenStatusBar();
|
|
|
|
}
|
|
|
|
else if(cstype == GAME_Strife)
|
|
|
|
{
|
|
|
|
StatusBar = CreateStrifeStatusBar();
|
|
|
|
}
|
2008-12-06 10:22:37 +00:00
|
|
|
else if(cstype == GAME_Any) //Use the default, empty or custom.
|
|
|
|
{
|
|
|
|
StatusBar = CreateCustomStatusBar(SCRIPT_CUSTOM);
|
|
|
|
}
|
|
|
|
else
|
2008-01-16 04:43:50 +00:00
|
|
|
{
|
2009-01-30 22:37:55 +00:00
|
|
|
StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT);
|
2008-01-16 04:43:50 +00:00
|
|
|
}
|
2007-12-20 22:35:02 +00:00
|
|
|
}
|
2008-01-16 04:43:50 +00:00
|
|
|
if (StatusBar == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-30 19:44:19 +00:00
|
|
|
if (gameinfo.gametype & GAME_DoomChex)
|
2008-01-16 04:43:50 +00:00
|
|
|
{
|
2009-01-30 22:37:55 +00:00
|
|
|
StatusBar = CreateCustomStatusBar (SCRIPT_DEFAULT);
|
2008-01-16 04:43:50 +00:00
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Heretic)
|
|
|
|
{
|
|
|
|
StatusBar = CreateHereticStatusBar ();
|
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Hexen)
|
|
|
|
{
|
|
|
|
StatusBar = CreateHexenStatusBar ();
|
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
|
|
|
StatusBar = CreateStrifeStatusBar ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
StatusBar = new DBaseStatusBar (0);
|
2008-01-16 04:43:50 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-03-12 02:56:11 +00:00
|
|
|
GC::WriteBarrier(StatusBar);
|
2006-02-24 04:48:15 +00:00
|
|
|
StatusBar->AttachToPlayer (&players[consoleplayer]);
|
|
|
|
StatusBar->NewGame ();
|
|
|
|
setsizeneeded = true;
|
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
if (gameinfo.gametype == GAME_Strife || (SBarInfoScript != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-01-11 22:38:10 +00:00
|
|
|
// Set the initial quest log text for Strife.
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
players[i].SetLogText ("Find help");
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] If this map doesn't exist, bomb out
|
2008-04-05 12:14:33 +00:00
|
|
|
if (!P_CheckMapData(mapname))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
I_Error ("Could not find map %s\n", mapname);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldSpeed = GameSpeed;
|
2007-10-29 22:15:46 +00:00
|
|
|
wantFast = !!G_SkillProperty(SKILLP_FastMonsters);
|
2006-02-24 04:48:15 +00:00
|
|
|
GameSpeed = wantFast ? SPEED_Fast : SPEED_Normal;
|
|
|
|
|
|
|
|
if (!savegamerestore)
|
|
|
|
{
|
2006-04-16 19:09:36 +00:00
|
|
|
if (!netgame)
|
|
|
|
{ // [RH] Change the random seed for each new single player game
|
2009-03-27 04:49:17 +00:00
|
|
|
rngseed = rngseed + 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-04-16 19:09:36 +00:00
|
|
|
FRandom::StaticClearRandom ();
|
2009-02-03 19:11:43 +00:00
|
|
|
P_ClearACSVars(true);
|
2006-02-24 04:48:15 +00:00
|
|
|
level.time = 0;
|
|
|
|
level.maptime = 0;
|
2006-04-11 16:27:41 +00:00
|
|
|
level.totaltime = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (!multiplayer || !deathmatch)
|
|
|
|
{
|
|
|
|
InitPlayerClasses ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// force players to be initialized upon first level load
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
players[i].playerstate = PST_ENTER; // [BC]
|
|
|
|
}
|
|
|
|
|
|
|
|
usergame = !bTitleLevel; // will be set false if a demo
|
|
|
|
paused = 0;
|
|
|
|
demoplayback = false;
|
|
|
|
automapactive = false;
|
|
|
|
viewactive = true;
|
|
|
|
BorderNeedRefresh = screen->GetPageCount ();
|
|
|
|
|
|
|
|
//Added by MC: Initialize bots.
|
|
|
|
if (!deathmatch)
|
|
|
|
{
|
2008-03-28 00:38:17 +00:00
|
|
|
bglobal.Init ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-01-25 04:02:06 +00:00
|
|
|
if (mapname != level.mapname)
|
|
|
|
{
|
|
|
|
strcpy (level.mapname, mapname);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
if (bTitleLevel)
|
|
|
|
{
|
|
|
|
gamestate = GS_TITLELEVEL;
|
|
|
|
}
|
|
|
|
else if (gamestate != GS_STARTUP)
|
|
|
|
{
|
|
|
|
gamestate = GS_LEVEL;
|
|
|
|
}
|
|
|
|
G_DoLoadLevel (0, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// G_DoCompleted
|
|
|
|
//
|
2008-09-05 02:55:44 +00:00
|
|
|
static FString nextlevel;
|
2006-02-24 04:48:15 +00:00
|
|
|
static int startpos; // [RH] Support for multiple starts per level
|
2006-09-14 00:02:31 +00:00
|
|
|
extern int NoWipe; // [RH] Don't wipe when travelling in hubs
|
2006-02-24 04:48:15 +00:00
|
|
|
static bool startkeepfacing; // [RH] Support for keeping your facing angle
|
2006-08-10 15:28:12 +00:00
|
|
|
static bool resetinventory; // Reset the inventory to the player's default for the next level
|
2007-09-06 09:54:57 +00:00
|
|
|
static bool unloading;
|
2007-11-08 09:22:06 +00:00
|
|
|
static bool g_nomonsters;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2006-02-24 04:48:15 +00:00
|
|
|
// [RH] The position parameter to these next three functions should
|
|
|
|
// match the first parameter of the single player start spots
|
|
|
|
// that should appear in the next map.
|
2009-02-03 19:11:43 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-08-10 15:28:12 +00:00
|
|
|
|
2008-09-05 02:55:44 +00:00
|
|
|
void G_ChangeLevel(const char *levelname, int position, bool keepFacing, int nextSkill,
|
2007-09-06 09:54:57 +00:00
|
|
|
bool nointermission, bool resetinv, bool nomonsters)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-06 12:46:35 +00:00
|
|
|
level_info_t *nextinfo = NULL;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (unloading)
|
|
|
|
{
|
|
|
|
Printf (TEXTCOLOR_RED "Unloading scripts cannot exit the level again.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-09-05 02:55:44 +00:00
|
|
|
nextlevel = levelname;
|
2007-09-06 09:54:57 +00:00
|
|
|
|
2008-09-05 02:55:44 +00:00
|
|
|
if (strncmp(levelname, "enDSeQ", 6))
|
2007-09-06 09:54:57 +00:00
|
|
|
{
|
2009-06-06 12:46:35 +00:00
|
|
|
nextinfo = FindLevelInfo (nextlevel)->CheckLevelRedirect ();
|
2007-09-06 09:54:57 +00:00
|
|
|
if (nextinfo)
|
|
|
|
{
|
2008-09-05 02:55:44 +00:00
|
|
|
nextlevel = nextinfo->mapname;
|
2007-09-06 09:54:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nextSkill != -1) NextSkill = nextSkill;
|
|
|
|
|
2007-11-08 09:22:06 +00:00
|
|
|
g_nomonsters = nomonsters;
|
2007-09-06 09:54:57 +00:00
|
|
|
|
|
|
|
if (nointermission) level.flags |= LEVEL_NOINTERMISSION;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
cluster_info_t *thiscluster = FindClusterInfo (level.cluster);
|
2009-06-06 12:46:35 +00:00
|
|
|
cluster_info_t *nextcluster = nextinfo? FindClusterInfo (nextinfo->cluster) : NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
startpos = position;
|
|
|
|
startkeepfacing = keepFacing;
|
|
|
|
gameaction = ga_completed;
|
2006-08-10 15:28:12 +00:00
|
|
|
resetinventory = resetinv;
|
2009-06-06 12:46:35 +00:00
|
|
|
|
|
|
|
if (nextinfo != NULL)
|
|
|
|
{
|
|
|
|
if (thiscluster != nextcluster || (thiscluster && !(thiscluster->flags & CLUSTER_HUB)))
|
|
|
|
{
|
|
|
|
resetinventory |= !!(nextinfo->flags2 & LEVEL2_RESETINVENTORY);
|
|
|
|
}
|
|
|
|
}
|
2006-08-10 15:28:12 +00:00
|
|
|
|
2008-03-28 00:38:17 +00:00
|
|
|
bglobal.End(); //Added by MC:
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Give scripts a chance to do something
|
|
|
|
unloading = true;
|
|
|
|
FBehavior::StaticStartTypedScripts (SCRIPT_Unloading, NULL, false, 0, true);
|
|
|
|
unloading = false;
|
|
|
|
|
|
|
|
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
|
|
|
|
{
|
|
|
|
if ((level.flags & LEVEL_NOINTERMISSION) || (nextcluster == thiscluster))
|
2007-03-06 01:33:18 +00:00
|
|
|
NoWipe = 35;
|
2006-02-24 04:48:15 +00:00
|
|
|
D_DrawIcon = "TELEICON";
|
|
|
|
}
|
2006-05-14 14:30:13 +00:00
|
|
|
|
2008-01-11 01:43:37 +00:00
|
|
|
for(int i = 0; i < MAXPLAYERS; i++)
|
2006-05-14 14:30:13 +00:00
|
|
|
{
|
2008-01-11 01:43:37 +00:00
|
|
|
if (playeringame[i])
|
|
|
|
{
|
|
|
|
player_t *player = &players[i];
|
|
|
|
|
|
|
|
// Un-crouch all players here.
|
|
|
|
player->Uncrouch();
|
|
|
|
|
|
|
|
// If this is co-op, respawn any dead players now so they can
|
|
|
|
// keep their inventory on the next map.
|
2009-02-06 04:43:51 +00:00
|
|
|
if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN) && !deathmatch && player->playerstate == PST_DEAD)
|
2008-01-11 01:43:37 +00:00
|
|
|
{
|
|
|
|
// Copied from the end of P_DeathThink [[
|
|
|
|
player->cls = NULL; // Force a new class if the player is using a random class
|
|
|
|
player->playerstate = PST_REBORN;
|
|
|
|
if (player->mo->special1 > 2)
|
|
|
|
{
|
|
|
|
player->mo->special1 = 0;
|
|
|
|
}
|
|
|
|
// ]]
|
|
|
|
G_DoReborn(i, false);
|
|
|
|
}
|
|
|
|
}
|
2006-05-14 14:30:13 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-02-12 05:54:03 +00:00
|
|
|
const char *G_GetExitMap()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-02-12 05:54:03 +00:00
|
|
|
return level.nextmap;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-02-12 05:54:03 +00:00
|
|
|
const char *G_GetSecretExitMap()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-11-19 08:13:23 +00:00
|
|
|
const char *nextmap = level.nextmap;
|
2006-08-10 15:28:12 +00:00
|
|
|
|
2007-11-19 08:13:23 +00:00
|
|
|
if (level.secretmap[0] != 0)
|
2007-09-06 09:54:57 +00:00
|
|
|
{
|
2008-04-05 12:14:33 +00:00
|
|
|
if (P_CheckMapData(level.secretmap))
|
2007-11-19 08:13:23 +00:00
|
|
|
{
|
|
|
|
nextmap = level.secretmap;
|
|
|
|
}
|
2007-09-06 09:54:57 +00:00
|
|
|
}
|
2008-02-12 05:54:03 +00:00
|
|
|
return nextmap;
|
|
|
|
}
|
2006-08-10 15:28:12 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-02-12 05:54:03 +00:00
|
|
|
void G_ExitLevel (int position, bool keepFacing)
|
|
|
|
{
|
|
|
|
G_ChangeLevel(G_GetExitMap(), position, keepFacing);
|
|
|
|
}
|
|
|
|
|
|
|
|
void G_SecretExitLevel (int position)
|
|
|
|
{
|
|
|
|
G_ChangeLevel(G_GetSecretExitMap(), position, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_DoCompleted (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
|
|
|
|
if (gamestate == GS_TITLELEVEL)
|
|
|
|
{
|
2008-09-05 02:55:44 +00:00
|
|
|
strncpy (level.mapname, nextlevel, 255);
|
2006-02-24 04:48:15 +00:00
|
|
|
G_DoLoadLevel (startpos, false);
|
|
|
|
startpos = 0;
|
|
|
|
viewactive = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Mark this level as having been visited
|
|
|
|
if (!(level.flags & LEVEL_CHANGEMAPCHEAT))
|
|
|
|
FindLevelInfo (level.mapname)->flags |= LEVEL_VISITED;
|
|
|
|
|
|
|
|
if (automapactive)
|
|
|
|
AM_Stop ();
|
|
|
|
|
|
|
|
wminfo.finished_ep = level.cluster - 1;
|
2008-09-21 18:02:38 +00:00
|
|
|
wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->pname, FTexture::TEX_MiscPatch)];
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
wminfo.current = level.mapname;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (deathmatch &&
|
|
|
|
(dmflags & DF_SAME_LEVEL) &&
|
|
|
|
!(level.flags & LEVEL_CHANGEMAPCHEAT))
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
wminfo.next = level.mapname;
|
2008-09-21 18:02:38 +00:00
|
|
|
wminfo.LName1 = wminfo.LName0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-09-06 09:54:57 +00:00
|
|
|
if (strncmp (nextlevel, "enDSeQ", 6) == 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-08-30 10:43:51 +00:00
|
|
|
wminfo.next = nextlevel;
|
2008-09-21 18:02:38 +00:00
|
|
|
wminfo.LName1 = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2007-09-06 09:54:57 +00:00
|
|
|
else
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-09-06 09:54:57 +00:00
|
|
|
level_info_t *nextinfo = FindLevelInfo (nextlevel);
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
wminfo.next = nextinfo->mapname;
|
2008-09-21 18:02:38 +00:00
|
|
|
wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckWarpTransMap (wminfo.next, true);
|
2008-09-05 02:55:44 +00:00
|
|
|
nextlevel = wminfo.next;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-05 02:55:44 +00:00
|
|
|
wminfo.next_ep = FindLevelInfo (wminfo.next)->cluster - 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
wminfo.maxkills = level.total_monsters;
|
|
|
|
wminfo.maxitems = level.total_items;
|
|
|
|
wminfo.maxsecret = level.total_secrets;
|
|
|
|
wminfo.maxfrags = 0;
|
|
|
|
wminfo.partime = TICRATE * level.partime;
|
|
|
|
wminfo.sucktime = level.sucktime;
|
|
|
|
wminfo.pnum = consoleplayer;
|
2006-04-11 16:27:41 +00:00
|
|
|
wminfo.totaltime = level.totaltime;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<MAXPLAYERS ; i++)
|
|
|
|
{
|
|
|
|
wminfo.plyr[i].in = playeringame[i];
|
|
|
|
wminfo.plyr[i].skills = players[i].killcount;
|
|
|
|
wminfo.plyr[i].sitems = players[i].itemcount;
|
|
|
|
wminfo.plyr[i].ssecret = players[i].secretcount;
|
|
|
|
wminfo.plyr[i].stime = level.time;
|
|
|
|
memcpy (wminfo.plyr[i].frags, players[i].frags
|
|
|
|
, sizeof(wminfo.plyr[i].frags));
|
|
|
|
wminfo.plyr[i].fragcount = players[i].fragcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] If we're in a hub and staying within that hub, take a snapshot
|
|
|
|
// of the level. If we're traveling to a new hub, take stuff from
|
|
|
|
// the player and clear the world vars. If this is just an
|
|
|
|
// ordinary cluster (not a hub), take stuff from the player, but
|
|
|
|
// leave the world vars alone.
|
|
|
|
cluster_info_t *thiscluster = FindClusterInfo (level.cluster);
|
2007-09-06 09:54:57 +00:00
|
|
|
cluster_info_t *nextcluster = FindClusterInfo (wminfo.next_ep+1); // next_ep is cluster-1
|
2006-02-24 04:48:15 +00:00
|
|
|
EFinishLevelType mode;
|
|
|
|
|
|
|
|
if (thiscluster != nextcluster || deathmatch ||
|
|
|
|
!(thiscluster->flags & CLUSTER_HUB))
|
|
|
|
{
|
|
|
|
if (nextcluster->flags & CLUSTER_HUB)
|
|
|
|
{
|
|
|
|
mode = FINISH_NextHub;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mode = FINISH_NoHub;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mode = FINISH_SameHub;
|
|
|
|
}
|
|
|
|
|
2006-04-11 16:27:41 +00:00
|
|
|
// Intermission stats for entire hubs
|
|
|
|
G_LeavingHub(mode, thiscluster, &wminfo);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (playeringame[i])
|
|
|
|
{ // take away appropriate inventory
|
2006-08-10 15:28:12 +00:00
|
|
|
G_PlayerFinishLevel (i, mode, resetinventory);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode == FINISH_SameHub)
|
|
|
|
{ // Remember the level's state for re-entry.
|
|
|
|
G_SnapshotLevel ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Forget the states of all existing levels.
|
|
|
|
G_ClearSnapshots ();
|
|
|
|
|
|
|
|
if (mode == FINISH_NextHub)
|
|
|
|
{ // Reset world variables for the new hub.
|
2009-02-03 19:11:43 +00:00
|
|
|
P_ClearACSVars(false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-04-11 16:27:41 +00:00
|
|
|
// With hub statistics the time should be per hub.
|
|
|
|
// Additionally there is a global time counter now so nothing is missed by changing it
|
|
|
|
//else if (mode == FINISH_NoHub)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Reset time to zero if not entering/staying in a hub.
|
|
|
|
level.time = 0;
|
|
|
|
}
|
|
|
|
level.maptime = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!deathmatch &&
|
|
|
|
((level.flags & LEVEL_NOINTERMISSION) ||
|
|
|
|
((nextcluster == thiscluster) && (thiscluster->flags & CLUSTER_HUB))))
|
|
|
|
{
|
|
|
|
G_WorldDone ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gamestate = GS_INTERMISSION;
|
|
|
|
viewactive = false;
|
|
|
|
automapactive = false;
|
|
|
|
|
|
|
|
// [RH] If you ever get a statistics driver operational, adapt this.
|
|
|
|
// if (statcopy)
|
|
|
|
// memcpy (statcopy, &wminfo, sizeof(wminfo));
|
|
|
|
|
|
|
|
WI_Start (&wminfo);
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class DAutosaver : public DThinker
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DAutosaver, DThinker)
|
|
|
|
public:
|
|
|
|
void Tick ();
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS (DAutosaver)
|
|
|
|
|
|
|
|
void DAutosaver::Tick ()
|
|
|
|
{
|
2006-10-19 20:20:56 +00:00
|
|
|
Net_WriteByte (DEM_CHECKAUTOSAVE);
|
2006-02-24 04:48:15 +00:00
|
|
|
Destroy ();
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// G_DoLoadLevel
|
|
|
|
//
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
extern gamestate_t wipegamestate;
|
|
|
|
|
|
|
|
void G_DoLoadLevel (int position, bool autosave)
|
|
|
|
{
|
|
|
|
static int lastposition = 0;
|
|
|
|
gamestate_t oldgs = gamestate;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (NextSkill >= 0)
|
|
|
|
{
|
|
|
|
UCVarValue val;
|
|
|
|
val.Int = NextSkill;
|
|
|
|
gameskill.ForceSet (val, CVAR_Int);
|
|
|
|
NextSkill = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position == -1)
|
|
|
|
position = lastposition;
|
|
|
|
else
|
|
|
|
lastposition = position;
|
|
|
|
|
|
|
|
G_InitLevelLocals ();
|
|
|
|
StatusBar->DetachAllMessages ();
|
|
|
|
|
2008-01-26 16:42:16 +00:00
|
|
|
// Force 'teamplay' to 'true' if need be.
|
2009-02-03 19:11:43 +00:00
|
|
|
if (level.flags2 & LEVEL2_FORCETEAMPLAYON)
|
2008-01-26 16:42:16 +00:00
|
|
|
teamplay = true;
|
|
|
|
|
|
|
|
// Force 'teamplay' to 'false' if need be.
|
2009-02-03 19:11:43 +00:00
|
|
|
if (level.flags2 & LEVEL2_FORCETEAMPLAYOFF)
|
2008-01-26 16:42:16 +00:00
|
|
|
teamplay = false;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
Printf (
|
|
|
|
"\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
|
2006-04-11 16:27:41 +00:00
|
|
|
"\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"
|
|
|
|
TEXTCOLOR_BOLD "%s - %s\n\n",
|
2009-02-03 19:11:43 +00:00
|
|
|
level.mapname, level.LevelName.GetChars());
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (wipegamestate == GS_LEVEL)
|
|
|
|
wipegamestate = GS_FORCEWIPE;
|
|
|
|
|
|
|
|
if (gamestate != GS_TITLELEVEL)
|
|
|
|
{
|
|
|
|
gamestate = GS_LEVEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the sky map.
|
|
|
|
// First thing, we have a dummy sky texture name,
|
|
|
|
// a flat. The data is in the WAD only because
|
|
|
|
// we look for an actual index, instead of simply
|
|
|
|
// setting one.
|
|
|
|
skyflatnum = TexMan.GetTexture (gameinfo.SkyFlatName, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
|
|
|
|
|
|
|
|
// DOOM determines the sky texture to be used
|
|
|
|
// depending on the current episode and the game version.
|
2008-04-05 12:14:33 +00:00
|
|
|
// [RH] Fetch sky parameters from FLevelLocals.
|
2008-05-23 14:04:16 +00:00
|
|
|
sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
|
|
|
sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Set up details about sky rendering
|
|
|
|
R_InitSkyMap ();
|
|
|
|
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && (deathmatch || players[i].playerstate == PST_DEAD))
|
|
|
|
players[i].playerstate = PST_ENTER; // [BC]
|
2007-12-24 14:24:24 +00:00
|
|
|
memset (players[i].frags,0,sizeof(players[i].frags));
|
|
|
|
if (!(dmflags2 & DF2_YES_KEEPFRAGS) && (alwaysapplydmflags || deathmatch))
|
|
|
|
players[i].fragcount = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-11-08 09:22:06 +00:00
|
|
|
if (g_nomonsters)
|
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
level.flags2 |= LEVEL2_NOMONSTERS;
|
2007-11-08 09:22:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
level.flags2 &= ~LEVEL2_NOMONSTERS;
|
2007-11-08 09:22:06 +00:00
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
P_SetupLevel (level.mapname, position);
|
2009-02-21 23:17:37 +00:00
|
|
|
|
2008-01-05 12:15:10 +00:00
|
|
|
AM_LevelInit();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] Start lightning, if MAPINFO tells us to
|
|
|
|
if (level.flags & LEVEL_STARTLIGHTNING)
|
|
|
|
{
|
|
|
|
P_StartLightning ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
|
|
|
|
// clear cmd building stuff
|
|
|
|
ResetButtonStates ();
|
|
|
|
|
|
|
|
SendItemUse = NULL;
|
|
|
|
SendItemDrop = NULL;
|
|
|
|
mousex = mousey = 0;
|
|
|
|
sendpause = sendsave = sendturn180 = SendLand = false;
|
|
|
|
LocalViewAngle = 0;
|
|
|
|
LocalViewPitch = 0;
|
|
|
|
paused = 0;
|
|
|
|
|
|
|
|
//Added by MC: Initialize bots.
|
|
|
|
if (deathmatch)
|
|
|
|
{
|
2008-03-28 00:38:17 +00:00
|
|
|
bglobal.Init ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (timingdemo)
|
|
|
|
{
|
2006-09-14 00:02:31 +00:00
|
|
|
static bool firstTime = true;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (firstTime)
|
|
|
|
{
|
|
|
|
starttime = I_GetTime (false);
|
|
|
|
firstTime = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
level.starttime = gametic;
|
2006-04-30 21:49:18 +00:00
|
|
|
level.maptime = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
G_UnSnapshotLevel (!savegamerestore); // [RH] Restore the state of the level.
|
|
|
|
G_FinishTravel ();
|
|
|
|
if (players[consoleplayer].camera == NULL ||
|
|
|
|
players[consoleplayer].camera->player != NULL)
|
|
|
|
{ // If we are viewing through a player, make sure it is us.
|
|
|
|
players[consoleplayer].camera = players[consoleplayer].mo;
|
|
|
|
}
|
|
|
|
StatusBar->AttachToPlayer (&players[consoleplayer]);
|
|
|
|
P_DoDeferedScripts (); // [RH] Do script actions that were triggered on another map.
|
|
|
|
|
|
|
|
if (demoplayback || oldgs == GS_STARTUP || oldgs == GS_TITLELEVEL)
|
|
|
|
C_HideConsole ();
|
|
|
|
|
|
|
|
C_FlushDisplay ();
|
|
|
|
|
|
|
|
// [RH] Always save the game when entering a new level.
|
|
|
|
if (autosave && !savegamerestore && disableautosave < 1)
|
|
|
|
{
|
|
|
|
DAutosaver GCCNOWARN *dummy = new DAutosaver;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// G_WorldDone
|
|
|
|
//
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_WorldDone (void)
|
|
|
|
{
|
|
|
|
cluster_info_t *nextcluster;
|
|
|
|
cluster_info_t *thiscluster;
|
|
|
|
|
|
|
|
gameaction = ga_worlddone;
|
|
|
|
|
|
|
|
if (level.flags & LEVEL_CHANGEMAPCHEAT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
thiscluster = FindClusterInfo (level.cluster);
|
|
|
|
|
2007-09-06 09:54:57 +00:00
|
|
|
if (strncmp (nextlevel, "enDSeQ", 6) == 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder,
|
2006-02-24 04:48:15 +00:00
|
|
|
thiscluster->cdtrack, thiscluster->cdid,
|
2009-02-03 19:11:43 +00:00
|
|
|
thiscluster->finaleflat, thiscluster->ExitText,
|
2006-02-24 04:48:15 +00:00
|
|
|
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
|
|
|
|
thiscluster->flags & CLUSTER_FINALEPIC,
|
2007-09-26 21:50:05 +00:00
|
|
|
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
|
2009-08-30 10:43:51 +00:00
|
|
|
true, strtol(nextlevel.GetChars()+6, NULL, 16));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-09-06 09:54:57 +00:00
|
|
|
nextcluster = FindClusterInfo (FindLevelInfo (nextlevel)->cluster);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (nextcluster->cluster != level.cluster && !deathmatch)
|
|
|
|
{
|
|
|
|
// Only start the finale if the next level's cluster is different
|
|
|
|
// than the current one and we're not in deathmatch.
|
2009-02-03 19:11:43 +00:00
|
|
|
if (nextcluster->EnterText.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
F_StartFinale (nextcluster->MessageMusic, nextcluster->musicorder,
|
2006-02-24 04:48:15 +00:00
|
|
|
nextcluster->cdtrack, nextcluster->cdid,
|
2009-02-03 19:11:43 +00:00
|
|
|
nextcluster->finaleflat, nextcluster->EnterText,
|
2006-02-24 04:48:15 +00:00
|
|
|
nextcluster->flags & CLUSTER_ENTERTEXTINLUMP,
|
|
|
|
nextcluster->flags & CLUSTER_FINALEPIC,
|
2007-09-26 21:50:05 +00:00
|
|
|
nextcluster->flags & CLUSTER_LOOKUPENTERTEXT,
|
|
|
|
false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
else if (thiscluster->ExitText.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder,
|
2006-02-24 04:48:15 +00:00
|
|
|
thiscluster->cdtrack, nextcluster->cdid,
|
2009-02-03 19:11:43 +00:00
|
|
|
thiscluster->finaleflat, thiscluster->ExitText,
|
2006-02-24 04:48:15 +00:00
|
|
|
thiscluster->flags & CLUSTER_EXITTEXTINLUMP,
|
|
|
|
thiscluster->flags & CLUSTER_FINALEPIC,
|
2007-09-26 21:50:05 +00:00
|
|
|
thiscluster->flags & CLUSTER_LOOKUPEXITTEXT,
|
|
|
|
false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_DoWorldDone (void)
|
|
|
|
{
|
|
|
|
gamestate = GS_LEVEL;
|
|
|
|
if (wminfo.next[0] == 0)
|
|
|
|
{
|
|
|
|
// Don't crash if no next map is given. Just repeat the current one.
|
|
|
|
Printf ("No next map specified.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-05 02:55:44 +00:00
|
|
|
strncpy (level.mapname, nextlevel, 255);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
G_StartTravel ();
|
|
|
|
G_DoLoadLevel (startpos, true);
|
|
|
|
startpos = 0;
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
viewactive = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// G_StartTravel
|
|
|
|
//
|
|
|
|
// Moves players (and eventually their inventory) to a different statnum,
|
|
|
|
// so they will not be destroyed when switching levels. This only applies
|
|
|
|
// to real players, not voodoo dolls.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void G_StartTravel ()
|
|
|
|
{
|
|
|
|
if (deathmatch)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i])
|
|
|
|
{
|
|
|
|
AActor *pawn = players[i].mo;
|
|
|
|
AInventory *inv;
|
|
|
|
|
|
|
|
// Only living players travel. Dead ones get a new body on the new level.
|
|
|
|
if (players[i].health > 0)
|
|
|
|
{
|
|
|
|
pawn->UnlinkFromWorld ();
|
2006-05-18 04:25:26 +00:00
|
|
|
P_DelSector_List ();
|
2008-02-10 03:24:25 +00:00
|
|
|
int tid = pawn->tid; // Save TID
|
2006-02-24 04:48:15 +00:00
|
|
|
pawn->RemoveFromHash ();
|
2008-02-10 03:24:25 +00:00
|
|
|
pawn->tid = tid; // Restore TID (but no longer linked into the hash chain)
|
2006-02-24 04:48:15 +00:00
|
|
|
pawn->ChangeStatNum (STAT_TRAVELLING);
|
|
|
|
|
|
|
|
for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory)
|
|
|
|
{
|
|
|
|
inv->ChangeStatNum (STAT_TRAVELLING);
|
|
|
|
inv->UnlinkFromWorld ();
|
2006-05-18 04:25:26 +00:00
|
|
|
P_DelSector_List ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// G_FinishTravel
|
|
|
|
//
|
|
|
|
// Moves any travelling players so that they occupy their newly-spawned
|
|
|
|
// copies' locations, destroying the new players in the process (because
|
|
|
|
// they are really fake placeholders to show where the travelling players
|
|
|
|
// should go).
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void G_FinishTravel ()
|
|
|
|
{
|
|
|
|
TThinkerIterator<APlayerPawn> it (STAT_TRAVELLING);
|
2006-05-11 05:00:35 +00:00
|
|
|
APlayerPawn *pawn, *pawndup, *oldpawn, *next;
|
2006-02-24 04:48:15 +00:00
|
|
|
AInventory *inv;
|
|
|
|
|
|
|
|
next = it.Next ();
|
|
|
|
while ( (pawn = next) != NULL)
|
|
|
|
{
|
|
|
|
next = it.Next ();
|
|
|
|
pawn->ChangeStatNum (STAT_PLAYER);
|
|
|
|
pawndup = pawn->player->mo;
|
|
|
|
assert (pawn != pawndup);
|
|
|
|
if (pawndup == NULL)
|
|
|
|
{ // Oh no! there was no start for this player!
|
|
|
|
pawn->flags |= MF_NOSECTOR|MF_NOBLOCKMAP;
|
|
|
|
pawn->Destroy ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-11 05:00:35 +00:00
|
|
|
oldpawn = pawndup;
|
2006-05-27 10:27:51 +00:00
|
|
|
|
|
|
|
// The player being spawned here is a short lived dummy and
|
|
|
|
// must not start any ENTER script or big problems will happen.
|
2008-04-04 14:31:20 +00:00
|
|
|
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], true);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!startkeepfacing)
|
|
|
|
{
|
|
|
|
pawn->angle = pawndup->angle;
|
|
|
|
pawn->pitch = pawndup->pitch;
|
|
|
|
}
|
|
|
|
pawn->x = pawndup->x;
|
|
|
|
pawn->y = pawndup->y;
|
|
|
|
pawn->z = pawndup->z;
|
2009-06-30 20:57:51 +00:00
|
|
|
pawn->velx = pawndup->velx;
|
|
|
|
pawn->vely = pawndup->vely;
|
|
|
|
pawn->velz = pawndup->velz;
|
2006-02-24 04:48:15 +00:00
|
|
|
pawn->Sector = pawndup->Sector;
|
|
|
|
pawn->floorz = pawndup->floorz;
|
|
|
|
pawn->ceilingz = pawndup->ceilingz;
|
|
|
|
pawn->dropoffz = pawndup->dropoffz;
|
|
|
|
pawn->floorsector = pawndup->floorsector;
|
|
|
|
pawn->floorpic = pawndup->floorpic;
|
2006-04-17 13:53:34 +00:00
|
|
|
pawn->ceilingsector = pawndup->ceilingsector;
|
|
|
|
pawn->ceilingpic = pawndup->ceilingpic;
|
2006-02-24 04:48:15 +00:00
|
|
|
pawn->floorclip = pawndup->floorclip;
|
|
|
|
pawn->waterlevel = pawndup->waterlevel;
|
|
|
|
pawn->target = NULL;
|
|
|
|
pawn->lastenemy = NULL;
|
|
|
|
pawn->player->mo = pawn;
|
2008-03-12 16:27:47 +00:00
|
|
|
DObject::StaticPointerSubstitution (oldpawn, pawn);
|
2006-05-11 05:00:35 +00:00
|
|
|
oldpawn->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
pawndup->Destroy ();
|
|
|
|
pawn->LinkToWorld ();
|
|
|
|
pawn->AddToHash ();
|
2006-10-06 21:07:58 +00:00
|
|
|
pawn->SetState(pawn->SpawnState);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory)
|
|
|
|
{
|
|
|
|
inv->ChangeStatNum (STAT_INVENTORY);
|
|
|
|
inv->LinkToWorld ();
|
|
|
|
inv->Travelled ();
|
|
|
|
}
|
2009-02-05 02:55:28 +00:00
|
|
|
if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED)
|
|
|
|
{
|
|
|
|
pawn->Speed = pawn->GetDefault()->Speed;
|
|
|
|
}
|
2008-02-13 02:29:49 +00:00
|
|
|
if (level.FromSnapshot)
|
|
|
|
{
|
|
|
|
FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_InitLevelLocals ()
|
|
|
|
{
|
|
|
|
level_info_t *info;
|
|
|
|
|
|
|
|
BaseBlendA = 0.0f; // Remove underwater blend effect, if any
|
|
|
|
NormalLight.Maps = realcolormaps;
|
2007-05-20 11:08:36 +00:00
|
|
|
|
2007-12-26 05:20:30 +00:00
|
|
|
// [BB] Instead of just setting the color, we also have to reset Desaturate and build the lights.
|
2007-05-13 20:21:26 +00:00
|
|
|
NormalLight.ChangeColor (PalEntry (255, 255, 255), 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
level.gravity = sv_gravity * 35/TICRATE;
|
|
|
|
level.aircontrol = (fixed_t)(sv_aircontrol * 65536.f);
|
2007-12-22 22:04:20 +00:00
|
|
|
level.teamdamage = teamdamage;
|
2006-02-24 04:48:15 +00:00
|
|
|
level.flags = 0;
|
2009-02-06 00:16:57 +00:00
|
|
|
level.flags2 = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
info = FindLevelInfo (level.mapname);
|
|
|
|
|
|
|
|
level.info = info;
|
|
|
|
level.skyspeed1 = info->skyspeed1;
|
|
|
|
level.skyspeed2 = info->skyspeed2;
|
|
|
|
strncpy (level.skypic2, info->skypic2, 8);
|
|
|
|
level.fadeto = info->fadeto;
|
|
|
|
level.cdtrack = info->cdtrack;
|
|
|
|
level.cdid = info->cdid;
|
2008-02-13 02:29:49 +00:00
|
|
|
level.FromSnapshot = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (level.fadeto == 0)
|
|
|
|
{
|
|
|
|
R_SetDefaultColormap (info->fadetable);
|
|
|
|
if (strnicmp (info->fadetable, "COLORMAP", 8) != 0)
|
|
|
|
{
|
|
|
|
level.flags |= LEVEL_HASFADETABLE;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NormalLight.ChangeFade (level.fadeto);
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
level.airsupply = info->airsupply*TICRATE;
|
|
|
|
level.outsidefog = info->outsidefog;
|
2008-05-23 07:54:09 +00:00
|
|
|
level.WallVertLight = info->WallVertLight*2;
|
|
|
|
level.WallHorizLight = info->WallHorizLight*2;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (info->gravity != 0.f)
|
|
|
|
{
|
|
|
|
level.gravity = info->gravity * 35/TICRATE;
|
|
|
|
}
|
|
|
|
if (info->aircontrol != 0.f)
|
|
|
|
{
|
|
|
|
level.aircontrol = (fixed_t)(info->aircontrol * 65536.f);
|
|
|
|
}
|
2007-12-22 22:04:20 +00:00
|
|
|
if (info->teamdamage != 0.f)
|
|
|
|
{
|
|
|
|
level.teamdamage = info->teamdamage;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
G_AirControlChanged ();
|
|
|
|
|
2009-03-25 23:29:00 +00:00
|
|
|
cluster_info_t *clus = FindClusterInfo (info->cluster);
|
|
|
|
|
|
|
|
level.partime = info->partime;
|
|
|
|
level.sucktime = info->sucktime;
|
|
|
|
level.cluster = info->cluster;
|
|
|
|
level.clusterflags = clus ? clus->flags : 0;
|
|
|
|
level.flags |= info->flags;
|
|
|
|
level.flags2 |= info->flags2;
|
|
|
|
level.levelnum = info->levelnum;
|
|
|
|
level.Music = info->Music;
|
|
|
|
level.musicorder = info->musicorder;
|
|
|
|
|
|
|
|
level.LevelName = level.info->LookupLevelName();
|
2009-08-30 10:43:51 +00:00
|
|
|
strncpy (level.nextmap, info->nextmap, 10);
|
|
|
|
level.nextmap[10] = 0;
|
|
|
|
strncpy (level.secretmap, info->secretmap, 10);
|
|
|
|
level.secretmap[10] = 0;
|
2009-03-25 23:29:00 +00:00
|
|
|
strncpy (level.skypic1, info->skypic1, 8);
|
|
|
|
level.skypic1[8] = 0;
|
|
|
|
if (!level.skypic2[0])
|
|
|
|
strncpy (level.skypic2, level.skypic1, 8);
|
|
|
|
level.skypic2[8] = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-11 04:03:40 +00:00
|
|
|
compatflags.Callback();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-11 04:03:40 +00:00
|
|
|
NormalLight.ChangeFade (level.fadeto);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
bool FLevelLocals::IsJumpingAllowed() const
|
2007-12-11 04:03:40 +00:00
|
|
|
{
|
2008-03-18 18:18:18 +00:00
|
|
|
if (dmflags & DF_NO_JUMP)
|
2007-12-11 04:03:40 +00:00
|
|
|
return false;
|
2008-03-18 18:18:18 +00:00
|
|
|
if (dmflags & DF_YES_JUMP)
|
2007-12-11 04:03:40 +00:00
|
|
|
return true;
|
2008-03-18 18:18:18 +00:00
|
|
|
return !(level.flags & LEVEL_JUMP_NO);
|
2007-12-11 04:03:40 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
bool FLevelLocals::IsCrouchingAllowed() const
|
2007-12-11 04:03:40 +00:00
|
|
|
{
|
2008-03-18 18:18:18 +00:00
|
|
|
if (dmflags & DF_NO_CROUCH)
|
2007-12-11 04:03:40 +00:00
|
|
|
return false;
|
2008-03-18 18:18:18 +00:00
|
|
|
if (dmflags & DF_YES_CROUCH)
|
2007-12-11 04:03:40 +00:00
|
|
|
return true;
|
2008-03-18 18:18:18 +00:00
|
|
|
return !(level.flags & LEVEL_CROUCH_NO);
|
2007-12-11 04:03:40 +00:00
|
|
|
}
|
2006-06-03 12:30:11 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
bool FLevelLocals::IsFreelookAllowed() const
|
2007-12-11 04:03:40 +00:00
|
|
|
{
|
|
|
|
if (level.flags & LEVEL_FREELOOK_NO)
|
|
|
|
return false;
|
|
|
|
if (level.flags & LEVEL_FREELOOK_YES)
|
|
|
|
return true;
|
|
|
|
return !(dmflags & DF_NO_FREELOOK);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
FString CalcMapName (int episode, int level)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
FString lumpname;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (gameinfo.flags & GI_MAPxx)
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
lumpname.Format("MAP%02d", level);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
lumpname = "";
|
|
|
|
lumpname << 'E' << ('0' + episode) << 'M' << ('0' + level);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return lumpname;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void G_AirControlChanged ()
|
|
|
|
{
|
|
|
|
if (level.aircontrol <= 256)
|
|
|
|
{
|
|
|
|
level.airfriction = FRACUNIT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Friction is inversely proportional to the amount of control
|
|
|
|
float fric = ((float)level.aircontrol/65536.f) * -0.0941f + 1.0004f;
|
|
|
|
level.airfriction = (fixed_t)(fric * 65536.f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
|
|
|
{
|
2006-04-14 12:58:52 +00:00
|
|
|
int i = level.totaltime;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
arc << level.flags
|
2009-02-25 22:10:06 +00:00
|
|
|
<< level.flags2
|
2006-02-24 04:48:15 +00:00
|
|
|
<< level.fadeto
|
|
|
|
<< level.found_secrets
|
|
|
|
<< level.found_items
|
|
|
|
<< level.killed_monsters
|
|
|
|
<< level.gravity
|
2006-04-11 16:27:41 +00:00
|
|
|
<< level.aircontrol
|
2007-12-22 22:04:20 +00:00
|
|
|
<< level.teamdamage
|
2006-04-11 16:27:41 +00:00
|
|
|
<< level.maptime
|
2006-04-14 12:58:52 +00:00
|
|
|
<< i;
|
|
|
|
|
|
|
|
// Hub transitions must keep the current total time
|
|
|
|
if (!hubLoad)
|
2009-03-13 03:18:06 +00:00
|
|
|
level.totaltime = i;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (arc.IsStoring ())
|
|
|
|
{
|
|
|
|
arc.WriteName (level.skypic1);
|
|
|
|
arc.WriteName (level.skypic2);
|
|
|
|
}
|
2006-04-11 16:27:41 +00:00
|
|
|
else
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
strncpy (level.skypic1, arc.ReadName(), 8);
|
|
|
|
strncpy (level.skypic2, arc.ReadName(), 8);
|
2009-02-07 08:52:07 +00:00
|
|
|
sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
|
|
|
sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
|
2006-02-24 04:48:15 +00:00
|
|
|
R_InitSkyMap ();
|
|
|
|
}
|
|
|
|
|
|
|
|
G_AirControlChanged ();
|
|
|
|
|
|
|
|
BYTE t;
|
|
|
|
|
|
|
|
// Does this level have scrollers?
|
|
|
|
if (arc.IsStoring ())
|
|
|
|
{
|
|
|
|
t = level.Scrolls ? 1 : 0;
|
|
|
|
arc << t;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arc << t;
|
|
|
|
if (level.Scrolls)
|
|
|
|
{
|
|
|
|
delete[] level.Scrolls;
|
|
|
|
level.Scrolls = NULL;
|
|
|
|
}
|
|
|
|
if (t)
|
|
|
|
{
|
|
|
|
level.Scrolls = new FSectorScrollValues[numsectors];
|
|
|
|
memset (level.Scrolls, 0, sizeof(level.Scrolls)*numsectors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FBehavior::StaticSerializeModuleStates (arc);
|
2008-06-11 12:17:45 +00:00
|
|
|
if (arc.IsLoading()) interpolator.ClearInterpolations();
|
2006-02-24 04:48:15 +00:00
|
|
|
P_SerializeThinkers (arc, hubLoad);
|
|
|
|
P_SerializeWorld (arc);
|
|
|
|
P_SerializePolyobjs (arc);
|
|
|
|
StatusBar->Serialize (arc);
|
2008-06-04 17:53:15 +00:00
|
|
|
//SerializeInterpolations (arc);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
arc << level.total_monsters << level.total_items << level.total_secrets;
|
|
|
|
|
|
|
|
// Does this level have custom translations?
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
FRemapTable *trans;
|
2007-12-26 16:06:03 +00:00
|
|
|
WORD w;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (arc.IsStoring ())
|
|
|
|
{
|
2007-12-26 05:20:30 +00:00
|
|
|
for (unsigned int i = 0; i < translationtables[TRANSLATION_LevelScripted].Size(); ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
trans = translationtables[TRANSLATION_LevelScripted][i];
|
2007-12-26 16:06:03 +00:00
|
|
|
if (trans != NULL && !trans->IsIdentity())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-26 16:06:03 +00:00
|
|
|
w = WORD(i);
|
|
|
|
arc << w;
|
|
|
|
trans->Serialize(arc);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-26 16:06:03 +00:00
|
|
|
w = 0xffff;
|
|
|
|
arc << w;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-26 16:06:03 +00:00
|
|
|
while (arc << w, w != 0xffff)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-01-08 01:08:27 +00:00
|
|
|
trans = translationtables[TRANSLATION_LevelScripted].GetVal(w);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
if (trans == NULL)
|
|
|
|
{
|
|
|
|
trans = new FRemapTable;
|
2008-01-15 04:57:25 +00:00
|
|
|
translationtables[TRANSLATION_LevelScripted].SetVal(w, trans);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
2007-12-26 16:06:03 +00:00
|
|
|
trans->Serialize(arc);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-11 16:27:41 +00:00
|
|
|
|
|
|
|
// This must be saved, too, of course!
|
|
|
|
FCanvasTextureInfo::Serialize (arc);
|
2008-01-05 12:15:10 +00:00
|
|
|
AM_SerializeMarkers(arc);
|
2006-04-11 16:27:41 +00:00
|
|
|
|
2008-07-06 03:52:53 +00:00
|
|
|
P_SerializePlayers (arc, hubLoad);
|
2008-07-05 03:32:44 +00:00
|
|
|
P_SerializeSounds (arc);
|
2009-03-13 03:18:06 +00:00
|
|
|
if (arc.IsLoading())
|
2009-01-04 15:00:29 +00:00
|
|
|
{
|
2009-03-13 03:18:06 +00:00
|
|
|
for (i = 0; i < numsectors; i++)
|
|
|
|
{
|
|
|
|
P_Recalculate3DFloors(§ors[i]);
|
|
|
|
}
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].mo != NULL)
|
|
|
|
{
|
|
|
|
players[i].mo->SetupWeaponSlots();
|
|
|
|
}
|
|
|
|
}
|
2009-01-04 15:00:29 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2006-02-24 04:48:15 +00:00
|
|
|
// Archives the current level
|
2009-02-03 19:11:43 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_SnapshotLevel ()
|
|
|
|
{
|
|
|
|
if (level.info->snapshot)
|
|
|
|
delete level.info->snapshot;
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
if (level.info->isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
level.info->snapshotVer = SAVEVER;
|
|
|
|
level.info->snapshot = new FCompressedMemFile;
|
|
|
|
level.info->snapshot->Open ();
|
|
|
|
|
|
|
|
FArchive arc (*level.info->snapshot);
|
|
|
|
|
|
|
|
SaveVersion = SAVEVER;
|
|
|
|
G_SerializeLevel (arc, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2006-02-24 04:48:15 +00:00
|
|
|
// Unarchives the current level based on its snapshot
|
|
|
|
// The level should have already been loaded and setup.
|
2009-02-03 19:11:43 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_UnSnapshotLevel (bool hubLoad)
|
|
|
|
{
|
|
|
|
if (level.info->snapshot == NULL)
|
|
|
|
return;
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
if (level.info->isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
SaveVersion = level.info->snapshotVer;
|
|
|
|
level.info->snapshot->Reopen ();
|
|
|
|
FArchive arc (*level.info->snapshot);
|
|
|
|
if (hubLoad)
|
|
|
|
arc.SetHubTravel ();
|
|
|
|
G_SerializeLevel (arc, hubLoad);
|
|
|
|
arc.Close ();
|
2008-02-13 02:29:49 +00:00
|
|
|
level.FromSnapshot = true;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
TThinkerIterator<APlayerPawn> it;
|
|
|
|
APlayerPawn *pawn, *next;
|
|
|
|
|
|
|
|
next = it.Next();
|
|
|
|
while ((pawn = next) != 0)
|
|
|
|
{
|
|
|
|
next = it.Next();
|
|
|
|
if (pawn->player == NULL || pawn->player->mo == NULL || !playeringame[pawn->player - players])
|
|
|
|
{
|
2008-01-12 01:17:37 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
// If this isn't the unmorphed original copy of a player, destroy it, because it's extra.
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].morphTics && players[i].mo->tracer == pawn)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == MAXPLAYERS)
|
|
|
|
{
|
|
|
|
pawn->Destroy ();
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// No reason to keep the snapshot around once the level's been entered.
|
2009-02-03 19:11:43 +00:00
|
|
|
level.info->ClearSnapshot();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static void writeMapName (FArchive &arc, const char *name)
|
|
|
|
{
|
|
|
|
BYTE size;
|
|
|
|
if (name[7] != 0)
|
|
|
|
{
|
|
|
|
size = 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size = (BYTE)strlen (name);
|
|
|
|
}
|
|
|
|
arc << size;
|
|
|
|
arc.Write (name, size);
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void writeSnapShot (FArchive &arc, level_info_t *i)
|
|
|
|
{
|
|
|
|
arc << i->snapshotVer;
|
|
|
|
writeMapName (arc, i->mapname);
|
|
|
|
i->snapshot->Serialize (arc);
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_WriteSnapshots (FILE *file)
|
|
|
|
{
|
2006-05-04 06:14:52 +00:00
|
|
|
unsigned int i;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-04 06:14:52 +00:00
|
|
|
for (i = 0; i < wadlevelinfos.Size(); i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (wadlevelinfos[i].snapshot)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (file, SNAP_ID);
|
|
|
|
writeSnapShot (arc, (level_info_t *)&wadlevelinfos[i]);
|
|
|
|
}
|
|
|
|
}
|
2006-06-14 15:56:56 +00:00
|
|
|
if (TheDefaultLevelInfo.snapshot != NULL)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (file, DSNP_ID);
|
|
|
|
writeSnapShot(arc, &TheDefaultLevelInfo);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
FPNGChunkArchive *arc = NULL;
|
|
|
|
|
|
|
|
// Write out which levels have been visited
|
2006-05-04 06:14:52 +00:00
|
|
|
for (i = 0; i < wadlevelinfos.Size(); ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (wadlevelinfos[i].flags & LEVEL_VISITED)
|
|
|
|
{
|
|
|
|
if (arc == NULL)
|
|
|
|
{
|
|
|
|
arc = new FPNGChunkArchive (file, VIST_ID);
|
|
|
|
}
|
|
|
|
writeMapName (*arc, wadlevelinfos[i].mapname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arc != NULL)
|
|
|
|
{
|
|
|
|
BYTE zero = 0;
|
|
|
|
*arc << zero;
|
|
|
|
delete arc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store player classes to be used when spawning a random class
|
|
|
|
if (multiplayer)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc2 (file, RCLS_ID);
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
SBYTE cnum = SinglePlayerClass[i];
|
|
|
|
arc2 << cnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store player classes that are currently in use
|
|
|
|
FPNGChunkArchive arc3 (file, PCLS_ID);
|
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
BYTE pnum;
|
|
|
|
if (playeringame[i])
|
|
|
|
{
|
|
|
|
pnum = i;
|
|
|
|
arc3 << pnum;
|
|
|
|
arc3.UserWriteClass (players[i].cls);
|
|
|
|
}
|
|
|
|
pnum = 255;
|
|
|
|
arc3 << pnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void G_ReadSnapshots (PNGHandle *png)
|
|
|
|
{
|
|
|
|
DWORD chunkLen;
|
|
|
|
BYTE namelen;
|
|
|
|
char mapname[256];
|
|
|
|
level_info_t *i;
|
|
|
|
|
|
|
|
G_ClearSnapshots ();
|
|
|
|
|
|
|
|
chunkLen = (DWORD)M_FindPNGChunk (png, SNAP_ID);
|
|
|
|
while (chunkLen != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), SNAP_ID, chunkLen);
|
|
|
|
DWORD snapver;
|
|
|
|
|
|
|
|
arc << snapver;
|
|
|
|
arc << namelen;
|
|
|
|
arc.Read (mapname, namelen);
|
|
|
|
mapname[namelen] = 0;
|
|
|
|
i = FindLevelInfo (mapname);
|
|
|
|
i->snapshotVer = snapver;
|
|
|
|
i->snapshot = new FCompressedMemFile;
|
|
|
|
i->snapshot->Serialize (arc);
|
|
|
|
chunkLen = (DWORD)M_NextPNGChunk (png, SNAP_ID);
|
|
|
|
}
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
chunkLen = (DWORD)M_FindPNGChunk (png, DSNP_ID);
|
|
|
|
if (chunkLen != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), DSNP_ID, chunkLen);
|
|
|
|
DWORD snapver;
|
|
|
|
|
|
|
|
arc << snapver;
|
|
|
|
arc << namelen;
|
|
|
|
arc.Read (mapname, namelen);
|
|
|
|
TheDefaultLevelInfo.snapshotVer = snapver;
|
|
|
|
TheDefaultLevelInfo.snapshot = new FCompressedMemFile;
|
|
|
|
TheDefaultLevelInfo.snapshot->Serialize (arc);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
chunkLen = (DWORD)M_FindPNGChunk (png, VIST_ID);
|
|
|
|
if (chunkLen != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), VIST_ID, chunkLen);
|
|
|
|
|
|
|
|
arc << namelen;
|
|
|
|
while (namelen != 0)
|
|
|
|
{
|
|
|
|
arc.Read (mapname, namelen);
|
|
|
|
mapname[namelen] = 0;
|
|
|
|
i = FindLevelInfo (mapname);
|
|
|
|
i->flags |= LEVEL_VISITED;
|
|
|
|
arc << namelen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
chunkLen = (DWORD)M_FindPNGChunk (png, RCLS_ID);
|
|
|
|
if (chunkLen != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), PCLS_ID, chunkLen);
|
|
|
|
SBYTE cnum;
|
|
|
|
|
|
|
|
for (DWORD j = 0; j < chunkLen; ++j)
|
|
|
|
{
|
|
|
|
arc << cnum;
|
|
|
|
SinglePlayerClass[j] = cnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
chunkLen = (DWORD)M_FindPNGChunk (png, PCLS_ID);
|
|
|
|
if (chunkLen != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), RCLS_ID, chunkLen);
|
|
|
|
BYTE pnum;
|
|
|
|
|
|
|
|
arc << pnum;
|
|
|
|
while (pnum != 255)
|
|
|
|
{
|
|
|
|
arc.UserReadClass (players[pnum].cls);
|
|
|
|
arc << pnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
png->File->ResetFilePtr();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void writeDefereds (FArchive &arc, level_info_t *i)
|
|
|
|
{
|
|
|
|
writeMapName (arc, i->mapname);
|
|
|
|
arc << i->defered;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void P_WriteACSDefereds (FILE *file)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive *arc = NULL;
|
|
|
|
|
2006-05-04 06:14:52 +00:00
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (wadlevelinfos[i].defered)
|
|
|
|
{
|
|
|
|
if (arc == NULL)
|
|
|
|
{
|
|
|
|
arc = new FPNGChunkArchive (file, ACSD_ID);
|
|
|
|
}
|
|
|
|
writeDefereds (*arc, (level_info_t *)&wadlevelinfos[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arc != NULL)
|
|
|
|
{
|
|
|
|
// Signal end of defereds
|
|
|
|
BYTE zero = 0;
|
|
|
|
*arc << zero;
|
|
|
|
delete arc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void P_ReadACSDefereds (PNGHandle *png)
|
|
|
|
{
|
|
|
|
BYTE namelen;
|
|
|
|
char mapname[256];
|
|
|
|
size_t chunklen;
|
|
|
|
|
|
|
|
P_RemoveDefereds ();
|
|
|
|
|
|
|
|
if ((chunklen = M_FindPNGChunk (png, ACSD_ID)) != 0)
|
|
|
|
{
|
|
|
|
FPNGChunkArchive arc (png->File->GetFile(), ACSD_ID, chunklen);
|
|
|
|
|
|
|
|
arc << namelen;
|
|
|
|
while (namelen)
|
|
|
|
{
|
|
|
|
arc.Read (mapname, namelen);
|
|
|
|
mapname[namelen] = 0;
|
|
|
|
level_info_t *i = FindLevelInfo (mapname);
|
|
|
|
if (i == NULL)
|
|
|
|
{
|
|
|
|
I_Error ("Unknown map '%s' in savegame", mapname);
|
|
|
|
}
|
|
|
|
arc << i->defered;
|
|
|
|
arc << namelen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
png->File->ResetFilePtr();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
void FLevelLocals::Tick ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Reset carry sectors
|
|
|
|
if (Scrolls != NULL)
|
|
|
|
{
|
|
|
|
memset (Scrolls, 0, sizeof(*Scrolls)*numsectors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
void FLevelLocals::AddScroller (DScroller *scroller, int secnum)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (secnum < 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Scrolls == NULL)
|
|
|
|
{
|
|
|
|
Scrolls = new FSectorScrollValues[numsectors];
|
|
|
|
memset (Scrolls, 0, sizeof(*Scrolls)*numsectors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Lists all currently defined maps
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-05-15 17:16:32 +00:00
|
|
|
|
|
|
|
CCMD(listmaps)
|
|
|
|
{
|
|
|
|
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
|
|
|
|
{
|
|
|
|
level_info_t *info = &wadlevelinfos[i];
|
|
|
|
|
|
|
|
if (P_CheckMapData(info->mapname))
|
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
Printf("%s: '%s'\n", info->mapname, info->LookupLevelName().GetChars());
|
2008-05-15 17:16:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|