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.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
** It might be a good idea to move these into files that they are more
|
|
|
|
** closely related to, but right now, I am too lazy to do that.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
#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 "r_main.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"
|
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)
|
|
|
|
|
|
|
|
CCMD (toggleconsole)
|
|
|
|
{
|
|
|
|
C_ToggleConsole();
|
|
|
|
}
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
bool CheckCheatmode ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (((gameskill == sk_nightmare) || netgame || deathmatch) && (!sv_cheats))
|
|
|
|
{
|
|
|
|
Printf ("sv_cheats must be true to enable this command.\n");
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (iddqd)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_IDDQD);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
if (deathmatch && CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_GENERICCHEAT);
|
|
|
|
Net_WriteByte (CHT_CHASECAM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (idclev)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode () || netgame)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((argv.argc() > 1) && (*(argv[1] + 2) == 0) && *(argv[1] + 1) && *argv[1])
|
|
|
|
{
|
|
|
|
int epsd, map;
|
|
|
|
char buf[2];
|
|
|
|
char *mapname;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
MapData * mapd = P_OpenMapData(mapname);
|
|
|
|
if (mapd == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// So be it.
|
2006-06-19 15:31:10 +00:00
|
|
|
delete mapd;
|
2006-02-24 04:48:15 +00:00
|
|
|
Printf ("%s\n", GStrings("STSTR_CLEV"));
|
|
|
|
G_DeferedInitNew (mapname);
|
|
|
|
players[0].health = 0; // Force reset
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (hxvisit)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode ())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((argv.argc() > 1) && (*(argv[1] + 2) == 0) && *(argv[1] + 1) && *argv[1])
|
|
|
|
{
|
|
|
|
char mapname[9];
|
|
|
|
|
|
|
|
sprintf (mapname, "&wt@%c%c", argv[1][0], argv[1][1]);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
MapData * map = P_OpenMapData(mapname);
|
|
|
|
if (map != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// So be it.
|
2006-06-19 15:31:10 +00:00
|
|
|
delete map;
|
2006-02-24 04:48:15 +00:00
|
|
|
Printf ("%s\n", GStrings("STSTR_CLEV"));
|
|
|
|
G_DeferedInitNew (mapname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Printf ("No such map found\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (changemap)
|
|
|
|
{
|
- 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
|
|
|
if (who == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Printf ("Use the map command when not in a game.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- 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
|
|
|
if (who->player - players != Net_Arbitrator && multiplayer)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Printf ("Only player %d can change the map.\n", Net_Arbitrator+1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
2006-06-14 15:56:56 +00:00
|
|
|
MapData * map = P_OpenMapData(argv[1]);
|
|
|
|
if (map == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Printf ("No map %s\n", argv[1]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-14 15:56:56 +00:00
|
|
|
delete map;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (argv.argc() > 2)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_CHANGEMAP2);
|
|
|
|
Net_WriteByte (atoi(argv[2]));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_CHANGEMAP);
|
|
|
|
}
|
|
|
|
Net_WriteString (argv[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (gameversion)
|
|
|
|
{
|
2006-04-21 05:44:21 +00:00
|
|
|
Printf ("%s : " __DATE__ "\n", DOTVERSIONSTR);
|
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)
|
|
|
|
{
|
|
|
|
switch (C_ExecFile (argv[i], gamestate == GS_STARTUP))
|
|
|
|
{
|
|
|
|
case 1: Printf ("Could not open \"%s\"\n", argv[1]); break;
|
|
|
|
case 2: Printf ("Error parsing \"%s\"\n", argv[1]); break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (logfile)
|
|
|
|
{
|
|
|
|
char *timestr = myasctime ();
|
|
|
|
|
|
|
|
if (Logfile)
|
|
|
|
{
|
|
|
|
Printf ("Log stopped: %s\n", timestr);
|
|
|
|
fclose (Logfile);
|
|
|
|
Logfile = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv.argc() >= 2)
|
|
|
|
{
|
|
|
|
if ( (Logfile = fopen (argv[1], "w")) )
|
|
|
|
{
|
|
|
|
Printf ("Log started: %s\n", timestr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Could not start log\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (puke)
|
|
|
|
{
|
|
|
|
int argc = argv.argc();
|
|
|
|
|
|
|
|
if (argc < 2 || argc > 5)
|
|
|
|
{
|
|
|
|
Printf (" puke <script> [arg1] [arg2] [arg3]\n");
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
int arg[3] = { 0, 0, 0 };
|
|
|
|
int argn = MIN (argc - 2, 3), i;
|
|
|
|
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (error)
|
|
|
|
{
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
char *textcopy = copystring (argv[1]);
|
|
|
|
I_Error (textcopy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: error <error text>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (error_fatal)
|
|
|
|
{
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
char *textcopy = copystring (argv[1]);
|
|
|
|
I_FatalError (textcopy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: error_fatal <error text>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (dir)
|
|
|
|
{
|
2006-07-08 02:17:35 +00:00
|
|
|
FString dir;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argv.argc() == 1 || chdir (argv[1]))
|
|
|
|
{
|
2006-07-08 02:17:35 +00:00
|
|
|
match = argv.argc() == 1 ? "./*" : argv[1];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-07-08 02:17:35 +00:00
|
|
|
dir = ExtractFilePath (match);
|
|
|
|
if (dir[0] != '\0')
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-07-08 02:17:35 +00:00
|
|
|
match += dir.Len();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-07-08 02:17:35 +00:00
|
|
|
dir = "./";
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-07-08 02:17:35 +00:00
|
|
|
if (match[0] == '\0')
|
|
|
|
{
|
2006-02-24 04:48:15 +00:00
|
|
|
match = "*";
|
2006-07-08 02:17:35 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (chdir (dir))
|
|
|
|
{
|
2006-07-09 21:50:16 +00:00
|
|
|
Printf ("%s not found\n", dir.GetChars());
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
match = "*";
|
2006-07-08 02:17:35 +00:00
|
|
|
dir = argv[1];
|
|
|
|
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
|
|
|
|
{
|
|
|
|
Printf ("The arbitrator has disabled FOV changes.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_MYFOV);
|
|
|
|
}
|
|
|
|
Net_WriteByte (clamp (atoi (argv[1]), 5, 179));
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD r_visibility
|
|
|
|
//
|
|
|
|
// Controls how quickly light ramps across a 1/z range. Set this, and it
|
|
|
|
// sets all the r_*Visibility variables (except r_SkyVisibilily, which is
|
|
|
|
// currently unused).
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (r_visibility)
|
|
|
|
{
|
|
|
|
if (argv.argc() < 2)
|
|
|
|
{
|
|
|
|
Printf ("Visibility is %g\n", R_GetVisibility());
|
|
|
|
}
|
|
|
|
else if (!netgame)
|
|
|
|
{
|
|
|
|
R_SetVisibility (atof (argv[1]));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Visibility cannot be changed in net games.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD warp
|
|
|
|
//
|
|
|
|
// Warps to a specific location on a map
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (warp)
|
|
|
|
{
|
|
|
|
if (gamestate != GS_LEVEL)
|
|
|
|
{
|
|
|
|
Printf ("You can only warp inside a level.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (netgame)
|
|
|
|
{
|
|
|
|
Printf ("You cannot warp in a net game!\n");
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if (!usergame)
|
|
|
|
{
|
|
|
|
Printf ("not in a saveable game\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (gamestate != GS_LEVEL)
|
|
|
|
{
|
|
|
|
Printf ("not in a level\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(players[consoleplayer].health <= 0 && !multiplayer)
|
|
|
|
{
|
|
|
|
Printf ("player is dead in a single-player 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_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)
|
|
|
|
{
|
|
|
|
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
|
|
|
|
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, 0);
|
|
|
|
if (linetarget)
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
|
|
|
|
linetarget->GetClass()->TypeName.GetChars(),
|
|
|
|
linetarget->health,
|
|
|
|
linetarget->GetDefault()->health);
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
else Printf("No target found\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(monster)
|
|
|
|
{
|
|
|
|
AActor * mo;
|
|
|
|
|
|
|
|
if (CheckCheatmode ()) return;
|
|
|
|
TThinkerIterator<AActor> it;
|
|
|
|
|
2006-05-22 01:34:07 +00:00
|
|
|
while ( (mo = it.Next()) )
|
2006-04-13 16:52:24 +00:00
|
|
|
{
|
|
|
|
if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY))
|
|
|
|
{
|
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(),
|
|
|
|
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS);
|
2006-04-13 16:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
CCMD(items)
|
|
|
|
{
|
|
|
|
AActor * mo;
|
|
|
|
|
|
|
|
if (CheckCheatmode ()) return;
|
|
|
|
TThinkerIterator<AActor> it;
|
|
|
|
|
2006-05-22 01:34:07 +00:00
|
|
|
while ( (mo = it.Next()) )
|
2006-04-13 16:52:24 +00:00
|
|
|
{
|
|
|
|
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL)
|
|
|
|
{
|
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(),
|
|
|
|
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS);
|
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)
|
|
|
|
{
|
|
|
|
strncpy (level.skypic1, sky1name, 8);
|
|
|
|
sky1texture = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|