2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** c_cmds.cpp
|
|
|
|
** Miscellaneous console commands.
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
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 <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <direct.h>
|
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "version.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "c_dispatch.h"
|
|
|
|
|
|
|
|
#include "i_system.h"
|
|
|
|
|
2013-08-09 03:47:58 +00:00
|
|
|
#include "doomerrors.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "doomstat.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "g_game.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "templates.h"
|
|
|
|
#include "p_local.h"
|
2006-04-13 16:52:24 +00:00
|
|
|
#include "r_sky.h"
|
2006-06-14 15:56:56 +00:00
|
|
|
#include "p_setup.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "d_net.h"
|
2010-11-30 08:18:11 +00:00
|
|
|
#include "v_text.h"
|
|
|
|
#include "p_lnspec.h"
|
2011-07-05 10:02:38 +00:00
|
|
|
#include "v_video.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern FILE *Logfile;
|
2006-05-03 14:54:48 +00:00
|
|
|
extern bool insave;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
CVAR (Bool, sv_cheats, false, CVAR_SERVERINFO | CVAR_LATCH)
|
2009-03-11 19:28:10 +00:00
|
|
|
CVAR (Bool, sv_unlimited_pickup, false, CVAR_SERVERINFO)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
CCMD (toggleconsole)
|
|
|
|
{
|
|
|
|
C_ToggleConsole();
|
|
|
|
}
|
|
|
|
|
2010-05-01 17:29:25 +00:00
|
|
|
bool CheckCheatmode (bool printmsg)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-10-29 22:15:46 +00:00
|
|
|
if ((G_SkillProperty(SKILLP_DisableCheats) || netgame || deathmatch) && (!sv_cheats))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-05-01 17:29:25 +00:00
|
|
|
if (printmsg) Printf ("sv_cheats must be true to enable this command.\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (quit)
|
|
|
|
{
|
2006-05-03 14:54:48 +00:00
|
|
|
if (!insave) exit (0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (exit)
|
|
|
|
{
|
2006-05-03 14:54:48 +00:00
|
|
|
if (!insave) exit (0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
Cmd_God
|
|
|
|
|
|
|
|
Sets client to godmode
|
|
|
|
|
|
|
|
argv(0) god
|
|
|
|
==================
|
|
|
|
*/
|
|
|
|
CCMD (god)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_GOD);
|
|
|
|
}
|
|
|
|
|
2014-10-25 00:31:28 +00:00
|
|
|
CCMD(god2)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte(DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte(CHT_GOD2);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (iddqd)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_IDDQD);
|
|
|
|
}
|
|
|
|
|
2009-08-07 04:08:38 +00:00
|
|
|
CCMD (buddha)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte(DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte(CHT_BUDDHA);
|
|
|
|
}
|
|
|
|
|
2014-10-25 00:31:28 +00:00
|
|
|
CCMD(buddha2)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte(DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte(CHT_BUDDHA2);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (notarget)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_NOTARGET);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (fly)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_FLY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
==================
|
|
|
|
Cmd_Noclip
|
|
|
|
|
|
|
|
argv(0) noclip
|
|
|
|
==================
|
|
|
|
*/
|
|
|
|
CCMD (noclip)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_NOCLIP);
|
|
|
|
}
|
|
|
|
|
2012-08-22 21:31:48 +00:00
|
|
|
CCMD (noclip2)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_NOCLIP2);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (powerup)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_POWER);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (morphme)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
2006-10-27 03:03:34 +00:00
|
|
|
if (argv.argc() == 1)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_MORPH);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_MORPHEX);
|
|
|
|
Net_WriteString (argv[1]);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (anubis)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_ANUBIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
// [GRB]
|
|
|
|
CCMD (resurrect)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_RESSURECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXTERN_CVAR (Bool, chasedemo)
|
|
|
|
|
|
|
|
CCMD (chase)
|
|
|
|
{
|
|
|
|
if (demoplayback)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (chasedemo)
|
|
|
|
{
|
|
|
|
chasedemo = false;
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
players[i].cheats &= ~CF_CHASECAM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
chasedemo = true;
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
players[i].cheats |= CF_CHASECAM;
|
|
|
|
}
|
|
|
|
R_ResetViewInterpolation ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-28 09:49:15 +00:00
|
|
|
// Check if we're allowed to use chasecam.
|
2012-09-09 03:01:49 +00:00
|
|
|
if (gamestate != GS_LEVEL || (!(dmflags2 & DF2_CHASECAM) && deathmatch && CheckCheatmode ()))
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_CHASECAM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (idclev)
|
|
|
|
{
|
2009-09-27 02:01:24 +00:00
|
|
|
if (netgame)
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((argv.argc() > 1) && (*(argv[1] + 2) == 0) && *(argv[1] + 1) && *argv[1])
|
|
|
|
{
|
|
|
|
int epsd, map;
|
|
|
|
char buf[2];
|
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 mapname;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
buf[0] = argv[1][0] - '0';
|
|
|
|
buf[1] = argv[1][1] - '0';
|
|
|
|
|
|
|
|
if (gameinfo.flags & GI_MAPxx)
|
|
|
|
{
|
|
|
|
epsd = 1;
|
|
|
|
map = buf[0]*10 + buf[1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epsd = buf[0];
|
|
|
|
map = buf[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Catch invalid maps.
|
|
|
|
mapname = CalcMapName (epsd, map);
|
2006-06-19 15:31:10 +00:00
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
if (!P_CheckMapData(mapname))
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// So be it.
|
|
|
|
Printf ("%s\n", GStrings("STSTR_CLEV"));
|
|
|
|
G_DeferedInitNew (mapname);
|
2009-07-12 07:33:24 +00:00
|
|
|
//players[0].health = 0; // Force reset
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (hxvisit)
|
|
|
|
{
|
2009-09-27 02:01:24 +00:00
|
|
|
if (netgame)
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((argv.argc() > 1) && (*(argv[1] + 2) == 0) && *(argv[1] + 1) && *argv[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
|
|
|
FString mapname("&wt@");
|
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
|
|
|
mapname << argv[1][0] << argv[1][1];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (CheckWarpTransMap (mapname, false))
|
|
|
|
{
|
|
|
|
// Just because it's in MAPINFO doesn't mean it's in the wad.
|
2006-06-19 15:31:10 +00:00
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
if (P_CheckMapData(mapname))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// So be it.
|
|
|
|
Printf ("%s\n", GStrings("STSTR_CLEV"));
|
|
|
|
G_DeferedInitNew (mapname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Printf ("No such map found\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (changemap)
|
|
|
|
{
|
2013-03-15 21:41:01 +00:00
|
|
|
if (who == NULL || !usergame)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Printf ("Use the map command when not in a game.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-02-16 15:02:52 +00:00
|
|
|
if (!players[who->player - players].settings_controller && netgame)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-02-16 15:02:52 +00:00
|
|
|
Printf ("Only setting controllers can change the map.\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
2013-08-09 03:47:58 +00:00
|
|
|
try
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2013-08-09 03:47:58 +00:00
|
|
|
if (!P_CheckMapData(argv[1]))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2013-08-09 03:47:58 +00:00
|
|
|
Printf ("No map %s\n", argv[1]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-08-09 03:47:58 +00:00
|
|
|
if (argv.argc() > 2)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_CHANGEMAP2);
|
|
|
|
Net_WriteByte (atoi(argv[2]));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_CHANGEMAP);
|
|
|
|
}
|
|
|
|
Net_WriteString (argv[1]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2013-08-09 03:47:58 +00:00
|
|
|
}
|
|
|
|
catch(CRecoverableError &error)
|
|
|
|
{
|
|
|
|
if (error.GetMessage())
|
|
|
|
Printf("%s", error.GetMessage());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: changemap <map name> [position]\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (give)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode () || argv.argc() < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GIVECHEAT);
|
|
|
|
Net_WriteString (argv[1]);
|
|
|
|
if (argv.argc() > 2)
|
2006-04-21 05:44:21 +00:00
|
|
|
Net_WriteWord (clamp (atoi (argv[2]), 1, 32767));
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
2006-04-21 05:44:21 +00:00
|
|
|
Net_WriteWord (0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-12-23 14:23:52 +00:00
|
|
|
CCMD (take)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode () || argv.argc() < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_TAKECHEAT);
|
|
|
|
Net_WriteString (argv[1]);
|
|
|
|
if (argv.argc() > 2)
|
|
|
|
Net_WriteWord (clamp (atoi (argv[2]), 1, 32767));
|
|
|
|
else
|
|
|
|
Net_WriteWord (0);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (gameversion)
|
|
|
|
{
|
2015-08-16 18:33:34 +00:00
|
|
|
Printf ("%s @ %s\nCommit %s\n", GetVersionString(), GetGitTime(), GetGitHash());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (print)
|
|
|
|
{
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("print <name>: Print a string from the string table\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const char *str = GStrings[argv[1]];
|
|
|
|
if (str == NULL)
|
|
|
|
{
|
|
|
|
Printf ("%s unknown\n", argv[1]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("%s\n", str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (exec)
|
|
|
|
{
|
|
|
|
if (argv.argc() < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (int i = 1; i < argv.argc(); ++i)
|
|
|
|
{
|
2015-04-07 17:37:33 +00:00
|
|
|
if (!C_ExecFile(argv[i]))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2015-04-07 17:37:33 +00:00
|
|
|
Printf ("Could not exec \"%s\"\n", argv[i]);
|
|
|
|
break;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-09 13:20:49 +00:00
|
|
|
void execLogfile(const char *fn, bool append)
|
2014-04-16 07:53:07 +00:00
|
|
|
{
|
2016-02-09 13:20:49 +00:00
|
|
|
if ((Logfile = fopen(fn, append? "a" : "w")))
|
2014-04-16 07:53:07 +00:00
|
|
|
{
|
|
|
|
const char *timestr = myasctime();
|
|
|
|
Printf("Log started: %s\n", timestr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("Could not start log\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (logfile)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Logfile)
|
|
|
|
{
|
2014-04-16 07:53:07 +00:00
|
|
|
const char *timestr = myasctime();
|
|
|
|
Printf("Log stopped: %s\n", timestr);
|
2006-02-24 04:48:15 +00:00
|
|
|
fclose (Logfile);
|
|
|
|
Logfile = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv.argc() >= 2)
|
|
|
|
{
|
2016-02-09 13:20:49 +00:00
|
|
|
execLogfile(argv[1], argv.argc() >=3? !!argv[2]:false);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (puke)
|
|
|
|
{
|
|
|
|
int argc = argv.argc();
|
|
|
|
|
2012-02-26 03:36:05 +00:00
|
|
|
if (argc < 2 || argc > 6)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-02-26 03:36:05 +00:00
|
|
|
Printf ("Usage: puke <script> [arg1] [arg2] [arg3] [arg4]\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int script = atoi (argv[1]);
|
2006-08-17 00:19:26 +00:00
|
|
|
|
|
|
|
if (script == 0)
|
|
|
|
{ // Script 0 is reserved for Strife support. It is not pukable.
|
|
|
|
return;
|
|
|
|
}
|
2012-02-26 03:36:05 +00:00
|
|
|
int arg[4] = { 0, 0, 0, 0 };
|
|
|
|
int argn = MIN<int>(argc - 2, countof(arg)), i;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (i = 0; i < argn; ++i)
|
|
|
|
{
|
|
|
|
arg[i] = atoi (argv[2+i]);
|
|
|
|
}
|
|
|
|
|
2006-08-17 00:19:26 +00:00
|
|
|
if (script > 0)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_RUNSCRIPT);
|
|
|
|
Net_WriteWord (script);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_RUNSCRIPT2);
|
|
|
|
Net_WriteWord (-script);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
Net_WriteByte (argn);
|
|
|
|
for (i = 0; i < argn; ++i)
|
|
|
|
{
|
|
|
|
Net_WriteLong (arg[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-16 22:13:46 +00:00
|
|
|
CCMD (pukename)
|
|
|
|
{
|
|
|
|
int argc = argv.argc();
|
|
|
|
|
2012-02-26 03:36:05 +00:00
|
|
|
if (argc < 2 || argc > 7)
|
2012-02-16 22:13:46 +00:00
|
|
|
{
|
2012-02-26 03:36:05 +00:00
|
|
|
Printf ("Usage: pukename \"<script>\" [\"always\"] [arg1] [arg2] [arg3] [arg4]\n");
|
2012-02-16 22:13:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool always = false;
|
|
|
|
int argstart = 2;
|
2012-02-26 03:36:05 +00:00
|
|
|
int arg[4] = { 0, 0, 0, 0 };
|
2012-02-16 22:13:46 +00:00
|
|
|
int argn = 0, i;
|
|
|
|
|
|
|
|
if (argc > 2)
|
|
|
|
{
|
|
|
|
if (stricmp(argv[2], "always") == 0)
|
|
|
|
{
|
|
|
|
always = true;
|
|
|
|
argstart = 3;
|
|
|
|
}
|
2012-02-26 03:36:05 +00:00
|
|
|
argn = MIN<int>(argc - argstart, countof(arg));
|
2012-02-16 22:13:46 +00:00
|
|
|
for (i = 0; i < argn; ++i)
|
|
|
|
{
|
|
|
|
arg[i] = atoi(argv[argstart + i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Net_WriteByte(DEM_RUNNAMEDSCRIPT);
|
|
|
|
Net_WriteString(argv[1]);
|
|
|
|
Net_WriteByte(argn | (always << 7));
|
|
|
|
for (i = 0; i < argn; ++i)
|
|
|
|
{
|
|
|
|
Net_WriteLong(arg[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-02 18:54:57 +00:00
|
|
|
CCMD (special)
|
|
|
|
{
|
|
|
|
int argc = argv.argc();
|
|
|
|
|
|
|
|
if (argc < 2 || argc > 7)
|
|
|
|
{
|
|
|
|
Printf("Usage: special <special-name> [arg1] [arg2] [arg3] [arg4] [arg5]\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int specnum;
|
|
|
|
|
|
|
|
if (argv[1][0] >= '0' && argv[1][0] <= '9')
|
|
|
|
{
|
|
|
|
specnum = atoi(argv[1]);
|
|
|
|
if (specnum < 0 || specnum > 255)
|
|
|
|
{
|
|
|
|
Printf("Bad special number\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int min_args;
|
|
|
|
specnum = P_FindLineSpecial(argv[1], &min_args);
|
|
|
|
if (specnum == 0 || min_args < 0)
|
|
|
|
{
|
|
|
|
Printf("Unknown special\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (argc < 2 + min_args)
|
|
|
|
{
|
|
|
|
Printf("%s needs at least %d argument%s\n", argv[1], min_args, min_args == 1 ? "" : "s");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Net_WriteByte(DEM_RUNSPECIAL);
|
2016-01-24 23:45:59 +00:00
|
|
|
Net_WriteWord(specnum);
|
2011-01-02 18:54:57 +00:00
|
|
|
Net_WriteByte(argc - 2);
|
|
|
|
for (int i = 2; i < argc; ++i)
|
|
|
|
{
|
|
|
|
Net_WriteLong(atoi(argv[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (error)
|
|
|
|
{
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
char *textcopy = copystring (argv[1]);
|
2009-01-28 05:29:41 +00:00
|
|
|
I_Error ("%s", textcopy);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: error <error text>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (error_fatal)
|
|
|
|
{
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
char *textcopy = copystring (argv[1]);
|
2009-01-28 05:29:41 +00:00
|
|
|
I_FatalError ("%s", textcopy);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: error_fatal <error text>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-02 18:00:51 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD crashout
|
|
|
|
//
|
|
|
|
// Debugging routine for testing the crash logger.
|
|
|
|
// Useless in a win32 debug build, because that doesn't enable the crash logger.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
#if !defined(_WIN32) || !defined(_DEBUG)
|
|
|
|
CCMD (crashout)
|
|
|
|
{
|
|
|
|
*(volatile int *)0 = 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CCMD (dir)
|
|
|
|
{
|
2009-02-08 02:52:43 +00:00
|
|
|
FString dir, path;
|
2006-07-08 02:17:35 +00:00
|
|
|
char curdir[256];
|
|
|
|
const char *match;
|
2006-02-24 04:48:15 +00:00
|
|
|
findstate_t c_file;
|
|
|
|
void *file;
|
|
|
|
|
2006-07-08 02:17:35 +00:00
|
|
|
if (!getcwd (curdir, countof(curdir)))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Printf ("Current path too long\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-02-08 02:52:43 +00:00
|
|
|
if (argv.argc() > 1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-08 02:52:43 +00:00
|
|
|
path = NicePath(argv[1]);
|
|
|
|
if (chdir(path))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-08 02:52:43 +00:00
|
|
|
match = path;
|
|
|
|
dir = ExtractFilePath(path);
|
|
|
|
if (dir[0] != '\0')
|
|
|
|
{
|
|
|
|
match += dir.Len();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dir = "./";
|
|
|
|
}
|
|
|
|
if (match[0] == '\0')
|
|
|
|
{
|
|
|
|
match = "*";
|
|
|
|
}
|
|
|
|
if (chdir (dir))
|
|
|
|
{
|
|
|
|
Printf ("%s not found\n", dir.GetChars());
|
|
|
|
return;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
2006-07-08 02:17:35 +00:00
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
match = "*";
|
2009-02-08 02:52:43 +00:00
|
|
|
dir = path;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
match = "*";
|
2009-02-08 02:52:43 +00:00
|
|
|
dir = curdir;
|
|
|
|
}
|
|
|
|
if (dir[dir.Len()-1] != '/')
|
|
|
|
{
|
|
|
|
dir += '/';
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( (file = I_FindFirst (match, &c_file)) == ((void *)(-1)))
|
2006-07-09 21:50:16 +00:00
|
|
|
Printf ("Nothing matching %s%s\n", dir.GetChars(), match);
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
|
|
|
{
|
2006-07-09 21:50:16 +00:00
|
|
|
Printf ("Listing of %s%s:\n", dir.GetChars(), match);
|
2006-02-24 04:48:15 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (I_FindAttr (&c_file) & FA_DIREC)
|
|
|
|
Printf (PRINT_BOLD, "%s <dir>\n", I_FindName (&c_file));
|
|
|
|
else
|
|
|
|
Printf ("%s\n", I_FindName (&c_file));
|
|
|
|
} while (I_FindNext (file, &c_file) == 0);
|
|
|
|
I_FindClose (file);
|
|
|
|
}
|
|
|
|
|
|
|
|
chdir (curdir);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (fov)
|
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
player_t *player = who ? who->player : &players[consoleplayer];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("fov is %g\n", player->DesiredFOV);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (dmflags & DF_NO_FOV)
|
|
|
|
{
|
|
|
|
if (consoleplayer == Net_Arbitrator)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_FOV);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-16 15:02:52 +00:00
|
|
|
Printf ("A setting controller has disabled FOV changes.\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_MYFOV);
|
|
|
|
}
|
|
|
|
Net_WriteByte (clamp (atoi (argv[1]), 5, 179));
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD warp
|
|
|
|
//
|
|
|
|
// Warps to a specific location on a map
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (warp)
|
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (CheckCheatmode ())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (gamestate != GS_LEVEL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
Printf ("You can only warp inside a level.\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (argv.argc() != 3)
|
|
|
|
{
|
|
|
|
Printf ("Usage: warp <x> <y>\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_WARPCHEAT);
|
|
|
|
Net_WriteWord (atoi (argv[1]));
|
|
|
|
Net_WriteWord (atoi (argv[2]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD load
|
|
|
|
//
|
|
|
|
// Load a saved game.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (load)
|
|
|
|
{
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("usage: load <filename>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (netgame)
|
|
|
|
{
|
|
|
|
Printf ("cannot load during a network game\n");
|
|
|
|
return;
|
|
|
|
}
|
2006-05-03 22:45:01 +00:00
|
|
|
FString fname = argv[1];
|
2006-02-24 04:48:15 +00:00
|
|
|
DefaultExtension (fname, ".zds");
|
2006-05-03 22:45:01 +00:00
|
|
|
G_LoadGame (fname);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD save
|
|
|
|
//
|
|
|
|
// Save the current game.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (save)
|
|
|
|
{
|
|
|
|
if (argv.argc() < 2 || argv.argc() > 3)
|
|
|
|
{
|
|
|
|
Printf ("usage: save <filename> [description]\n");
|
|
|
|
return;
|
|
|
|
}
|
2006-05-03 22:45:01 +00:00
|
|
|
FString fname = argv[1];
|
2006-02-24 04:48:15 +00:00
|
|
|
DefaultExtension (fname, ".zds");
|
2006-05-03 22:45:01 +00:00
|
|
|
G_SaveGame (fname, argv.argc() > 2 ? argv[2] : argv[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD wdir
|
|
|
|
//
|
|
|
|
// Lists the contents of a loaded wad file.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (wdir)
|
|
|
|
{
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("usage: wdir <wadfile>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int wadnum = Wads.CheckIfWadLoaded (argv[1]);
|
|
|
|
if (wadnum < 0)
|
|
|
|
{
|
|
|
|
Printf ("%s must be loaded to view its directory.\n", argv[1]);
|
2006-06-11 01:06:19 +00:00
|
|
|
return;
|
2006-05-03 22:45:01 +00:00
|
|
|
}
|
|
|
|
for (int i = 0; i < Wads.GetNumLumps(); ++i)
|
|
|
|
{
|
|
|
|
if (Wads.GetLumpFile(i) == wadnum)
|
|
|
|
{
|
|
|
|
Printf ("%s\n", Wads.GetLumpFullName(i));
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-04-13 16:52:24 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(linetarget)
|
|
|
|
{
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
|
|
|
|
2006-04-13 16:52:24 +00:00
|
|
|
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
|
2008-04-10 14:38:43 +00:00
|
|
|
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, &linetarget, 0);
|
2006-04-13 16:52:24 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
|
|
|
|
linetarget->GetClass()->TypeName.GetChars(),
|
|
|
|
linetarget->health,
|
2009-07-04 18:17:44 +00:00
|
|
|
linetarget->SpawnHealth());
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
else Printf("No target found\n");
|
|
|
|
}
|
|
|
|
|
2009-09-14 19:44:14 +00:00
|
|
|
// As linetarget, but also give info about non-shootable actors
|
|
|
|
CCMD(info)
|
|
|
|
{
|
|
|
|
AActor *linetarget;
|
|
|
|
|
|
|
|
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
|
2010-03-28 10:51:35 +00:00
|
|
|
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE,
|
|
|
|
&linetarget, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
|
2009-09-14 19:44:14 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
|
|
|
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
|
|
|
|
linetarget->GetClass()->TypeName.GetChars(),
|
|
|
|
linetarget->health,
|
|
|
|
linetarget->SpawnHealth());
|
|
|
|
PrintMiscActorInfo(linetarget);
|
|
|
|
}
|
2015-01-06 22:16:25 +00:00
|
|
|
else Printf("No target found. Info cannot find actors that have "
|
|
|
|
"the NOBLOCKMAP flag or have height/radius of 0.\n");
|
2009-09-14 19:44:14 +00:00
|
|
|
}
|
|
|
|
|
2015-03-25 21:25:00 +00:00
|
|
|
typedef bool (*ActorTypeChecker) (AActor *);
|
|
|
|
|
|
|
|
static bool IsActorAMonster(AActor *mo)
|
2006-04-13 16:52:24 +00:00
|
|
|
{
|
2015-03-25 21:25:00 +00:00
|
|
|
return mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY);
|
|
|
|
}
|
2006-04-13 16:52:24 +00:00
|
|
|
|
2015-03-25 21:25:00 +00:00
|
|
|
static bool IsActorAnItem(AActor *mo)
|
|
|
|
{
|
|
|
|
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsActorACountItem(AActor *mo)
|
|
|
|
{
|
|
|
|
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName)
|
|
|
|
{
|
|
|
|
AActor *mo;
|
|
|
|
const PClass *FilterClass = NULL;
|
|
|
|
|
|
|
|
if (FilterName != NULL)
|
|
|
|
{
|
2015-04-28 10:03:06 +00:00
|
|
|
FilterClass = PClass::FindActor(FilterName);
|
|
|
|
if (FilterClass == NULL)
|
2015-03-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
Printf("%s is not an actor class.\n", FilterName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 16:52:24 +00:00
|
|
|
TThinkerIterator<AActor> it;
|
|
|
|
|
2006-05-22 01:34:07 +00:00
|
|
|
while ( (mo = it.Next()) )
|
2006-04-13 16:52:24 +00:00
|
|
|
{
|
2015-03-25 21:25:00 +00:00
|
|
|
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
|
2006-04-13 16:52:24 +00:00
|
|
|
{
|
2006-09-14 00:02:31 +00:00
|
|
|
Printf ("%s at (%d,%d,%d)\n",
|
2006-05-10 02:40:43 +00:00
|
|
|
mo->GetClass()->TypeName.GetChars(),
|
2016-01-17 12:48:16 +00:00
|
|
|
mo->X() >> FRACBITS, mo->Y() >> FRACBITS, mo->Z() >> FRACBITS);
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-25 21:25:00 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(monster)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ()) return;
|
|
|
|
|
|
|
|
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL);
|
|
|
|
}
|
|
|
|
|
2006-04-13 16:52:24 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(items)
|
|
|
|
{
|
2015-03-25 21:25:00 +00:00
|
|
|
if (CheckCheatmode ()) return;
|
|
|
|
|
|
|
|
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL);
|
|
|
|
}
|
2006-04-13 16:52:24 +00:00
|
|
|
|
2015-03-25 21:25:00 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(countitems)
|
|
|
|
{
|
2006-04-13 16:52:24 +00:00
|
|
|
if (CheckCheatmode ()) return;
|
|
|
|
|
2015-03-25 21:25:00 +00:00
|
|
|
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL);
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(changesky)
|
|
|
|
{
|
|
|
|
const char *sky1name;
|
|
|
|
|
|
|
|
if (netgame || argv.argc()<2) return;
|
|
|
|
|
|
|
|
sky1name = argv[1];
|
|
|
|
if (sky1name[0] != 0)
|
|
|
|
{
|
2014-05-13 09:33:59 +00:00
|
|
|
FTextureID newsky = TexMan.GetTexture(sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
|
|
|
|
if (newsky.Exists())
|
|
|
|
{
|
|
|
|
sky1texture = level.skytexture1 = newsky;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("changesky: Texture '%s' not found\n", sky1name);
|
|
|
|
}
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
R_InitSkyMap ();
|
|
|
|
}
|
2006-10-22 10:32:41 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2006-10-24 02:32:12 +00:00
|
|
|
CCMD(thaw)
|
2006-10-22 10:32:41 +00:00
|
|
|
{
|
2006-10-24 02:32:12 +00:00
|
|
|
if (CheckCheatmode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_CLEARFROZENPROPS);
|
2006-10-22 10:32:41 +00:00
|
|
|
}
|
2008-04-19 00:55:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(nextmap)
|
|
|
|
{
|
2012-08-04 02:42:16 +00:00
|
|
|
if (netgame)
|
|
|
|
{
|
2013-07-22 20:25:44 +00:00
|
|
|
Printf ("Use " TEXTCOLOR_BOLD "changemap" TEXTCOLOR_NORMAL " instead. " TEXTCOLOR_BOLD "Nextmap"
|
|
|
|
TEXTCOLOR_NORMAL " is for single-player only.\n");
|
2012-08-04 02:42:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-04-19 00:55:55 +00:00
|
|
|
|
2014-05-13 21:16:13 +00:00
|
|
|
if (level.NextMap.Len() > 0 && level.NextMap.Compare("enDSeQ", 6))
|
2008-04-19 00:55:55 +00:00
|
|
|
{
|
2014-05-13 21:16:13 +00:00
|
|
|
G_DeferedInitNew(level.NextMap);
|
2008-04-19 00:55:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("no next map!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(nextsecret)
|
|
|
|
{
|
2012-08-04 02:42:16 +00:00
|
|
|
if (netgame)
|
|
|
|
{
|
2013-07-22 20:25:44 +00:00
|
|
|
Printf ("Use " TEXTCOLOR_BOLD "changemap" TEXTCOLOR_NORMAL " instead. " TEXTCOLOR_BOLD "Nextsecret"
|
|
|
|
TEXTCOLOR_NORMAL " is for single-player only.\n");
|
2012-08-04 02:42:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-02-07 15:35:23 +00:00
|
|
|
|
2014-05-13 21:16:13 +00:00
|
|
|
if (level.NextSecretMap.Len() > 0 && level.NextSecretMap.Compare("enDSeQ", 6))
|
2008-04-19 00:55:55 +00:00
|
|
|
{
|
2014-05-13 21:16:13 +00:00
|
|
|
G_DeferedInitNew(level.NextSecretMap);
|
2008-04-19 00:55:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("no next secret map!\n");
|
|
|
|
}
|
|
|
|
}
|
2010-03-28 10:51:35 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2010-11-30 08:18:11 +00:00
|
|
|
|
2010-03-28 10:51:35 +00:00
|
|
|
CCMD(currentpos)
|
|
|
|
{
|
|
|
|
AActor *mo = players[consoleplayer].mo;
|
2016-01-24 02:47:20 +00:00
|
|
|
if(mo)
|
|
|
|
{
|
|
|
|
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
|
|
|
|
FIXED2FLOAT(mo->X()), FIXED2FLOAT(mo->Y()), FIXED2FLOAT(mo->Z()), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("You are not in game!");
|
|
|
|
}
|
2010-03-28 10:51:35 +00:00
|
|
|
}
|
|
|
|
|
2010-02-14 20:16:05 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(vmengine)
|
|
|
|
{
|
|
|
|
if (argv.argc() == 2)
|
|
|
|
{
|
|
|
|
if (stricmp(argv[1], "default") == 0)
|
|
|
|
{
|
|
|
|
VMSelectEngine(VMEngine_Default);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (stricmp(argv[1], "checked") == 0)
|
|
|
|
{
|
|
|
|
VMSelectEngine(VMEngine_Checked);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (stricmp(argv[1], "unchecked") == 0)
|
|
|
|
{
|
|
|
|
VMSelectEngine(VMEngine_Unchecked);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Printf("Usage: vmengine <default|checked|unchecked>\n");
|
|
|
|
}
|
2012-07-14 03:04:41 +00:00
|
|
|
|
2010-11-30 08:18:11 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Print secret info (submitted by Karl Murks)
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void PrintSecretString(const char *string, bool thislevel)
|
|
|
|
{
|
|
|
|
const char *colstr = thislevel? TEXTCOLOR_YELLOW : TEXTCOLOR_CYAN;
|
|
|
|
if (string != NULL)
|
|
|
|
{
|
|
|
|
if (*string == '$')
|
|
|
|
{
|
|
|
|
if (string[1] == 'S' || string[1] == 's')
|
|
|
|
{
|
|
|
|
long secnum = strtol(string+2, (char**)&string, 10);
|
|
|
|
if (*string == ';') string++;
|
|
|
|
if (thislevel && secnum >= 0 && secnum < numsectors)
|
|
|
|
{
|
2016-01-06 00:50:45 +00:00
|
|
|
if (sectors[secnum].isSecret()) colstr = TEXTCOLOR_RED;
|
|
|
|
else if (sectors[secnum].wasSecret()) colstr = TEXTCOLOR_GREEN;
|
2010-11-30 08:18:11 +00:00
|
|
|
else colstr = TEXTCOLOR_ORANGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (string[1] == 'T' || string[1] == 't')
|
|
|
|
{
|
|
|
|
long tid = strtol(string+2, (char**)&string, 10);
|
|
|
|
if (*string == ';') string++;
|
|
|
|
FActorIterator it(tid);
|
|
|
|
AActor *actor;
|
|
|
|
bool foundone = false;
|
|
|
|
if (thislevel)
|
|
|
|
{
|
|
|
|
while ((actor = it.Next()))
|
|
|
|
{
|
|
|
|
if (!actor->IsKindOf(PClass::FindClass("SecretTrigger"))) continue;
|
|
|
|
foundone = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-01-22 17:05:02 +00:00
|
|
|
if (foundone) colstr = TEXTCOLOR_RED;
|
|
|
|
else colstr = TEXTCOLOR_GREEN;
|
2010-11-30 08:18:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FBrokenLines *brok = V_BreakLines(ConFont, screen->GetWidth()*95/100, string);
|
|
|
|
|
|
|
|
for (int k = 0; brok[k].Width >= 0; k++)
|
|
|
|
{
|
|
|
|
Printf("%s%s\n", colstr, brok[k].Text.GetChars());
|
|
|
|
}
|
|
|
|
V_FreeBrokenLines(brok);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// Print secret hints
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
CCMD(secret)
|
|
|
|
{
|
2014-05-13 21:16:13 +00:00
|
|
|
const char *mapname = argv.argc() < 2? level.MapName.GetChars() : argv[1];
|
|
|
|
bool thislevel = !stricmp(mapname, level.MapName);
|
2010-11-30 08:18:11 +00:00
|
|
|
bool foundsome = false;
|
|
|
|
|
|
|
|
int lumpno=Wads.CheckNumForName("SECRETS");
|
|
|
|
if (lumpno < 0) return;
|
|
|
|
|
|
|
|
FWadLump lump = Wads.OpenLumpNum(lumpno);
|
|
|
|
FString maphdr;
|
|
|
|
maphdr.Format("[%s]", mapname);
|
|
|
|
|
|
|
|
FString linebuild;
|
|
|
|
char readbuffer[1024];
|
|
|
|
bool inlevel = false;
|
2010-09-14 17:28:18 +00:00
|
|
|
|
2010-11-30 08:18:11 +00:00
|
|
|
while (lump.Gets(readbuffer, 1024))
|
|
|
|
{
|
|
|
|
if (!inlevel)
|
|
|
|
{
|
|
|
|
if (readbuffer[0] == '[')
|
|
|
|
{
|
|
|
|
inlevel = !strnicmp(readbuffer, maphdr, maphdr.Len());
|
|
|
|
if (!foundsome)
|
|
|
|
{
|
|
|
|
FString levelname;
|
|
|
|
level_info_t *info = FindLevelInfo(mapname);
|
2012-06-03 15:59:44 +00:00
|
|
|
const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()];
|
|
|
|
levelname.Format("%s - %s\n", mapname, ln);
|
2010-11-30 08:18:11 +00:00
|
|
|
size_t llen = levelname.Len() - 1;
|
|
|
|
for(size_t ii=0; ii<llen; ii++) levelname += '-';
|
2010-12-09 07:50:08 +00:00
|
|
|
Printf(TEXTCOLOR_YELLOW"%s\n", levelname.GetChars());
|
2010-11-30 08:18:11 +00:00
|
|
|
foundsome = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (readbuffer[0] != '[')
|
|
|
|
{
|
|
|
|
linebuild += readbuffer;
|
|
|
|
if (linebuild.Len() < 1023 || linebuild[1022] == '\n')
|
|
|
|
{
|
|
|
|
// line complete so print it.
|
|
|
|
linebuild.Substitute("\r", "");
|
|
|
|
linebuild.StripRight(" \t\n");
|
|
|
|
PrintSecretString(linebuild, thislevel);
|
|
|
|
linebuild = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else inlevel = false;
|
|
|
|
}
|
|
|
|
}
|
2013-07-22 20:25:44 +00:00
|
|
|
}
|
2016-02-08 11:10:53 +00:00
|
|
|
|
|
|
|
CCMD(angleconvtest)
|
|
|
|
{
|
|
|
|
Printf("Testing degrees to angle conversion:\n");
|
|
|
|
for (double ang = -5 * 180.; ang < 5 * 180.; ang += 45.)
|
|
|
|
{
|
|
|
|
angle_t ang1 = FLOAT2ANGLE(ang);
|
|
|
|
angle_t ang2 = (angle_t)(ang * (ANGLE_90 / 90.));
|
|
|
|
angle_t ang3 = (angle_t)(int)(ang * (ANGLE_90 / 90.));
|
|
|
|
Printf("Angle = %.5f: xs_RoundToInt = %08x, unsigned cast = %08x, signed cast = %08x\n",
|
|
|
|
ang, ang1, ang2, ang3);
|
|
|
|
}
|
|
|
|
}
|