mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- Added pukename console command. This is mostly the same as puke, except the scripts are
named, and to run a script using ACS_ExecuteAlways, you need to add "always" after the script name but before any arguments. e.g.: pukename "A Script" 1 Will run the script "A Script" with a single argument of 1, provided the script is not already running. pukename "A Script" always 1 Will always run the script "A Script" with a single argument of 1. SVN r3365 (trunk)
This commit is contained in:
parent
7561beb212
commit
8f516a1007
4 changed files with 76 additions and 14 deletions
|
@ -489,6 +489,44 @@ CCMD (puke)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCMD (pukename)
|
||||||
|
{
|
||||||
|
int argc = argv.argc();
|
||||||
|
|
||||||
|
if (argc < 2 || argc > 6)
|
||||||
|
{
|
||||||
|
Printf ("Usage: pukename \"<script>\" [\"always\"] [arg1] [arg2] [arg3]\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool always = false;
|
||||||
|
int argstart = 2;
|
||||||
|
int arg[3] = { 0, 0, 0 };
|
||||||
|
int argn = 0, i;
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
{
|
||||||
|
if (stricmp(argv[2], "always") == 0)
|
||||||
|
{
|
||||||
|
always = true;
|
||||||
|
argstart = 3;
|
||||||
|
}
|
||||||
|
argn = MIN(argc - argstart, 3);
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CCMD (special)
|
CCMD (special)
|
||||||
{
|
{
|
||||||
int argc = argv.argc();
|
int argc = argv.argc();
|
||||||
|
|
|
@ -122,6 +122,7 @@ void G_BuildTiccmd (ticcmd_t *cmd);
|
||||||
void D_DoAdvanceDemo (void);
|
void D_DoAdvanceDemo (void);
|
||||||
|
|
||||||
static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETNODES], int len);
|
static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETNODES], int len);
|
||||||
|
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, bool always);
|
||||||
|
|
||||||
int reboundpacket;
|
int reboundpacket;
|
||||||
BYTE reboundstore[MAX_MSGLEN];
|
BYTE reboundstore[MAX_MSGLEN];
|
||||||
|
@ -2315,18 +2316,17 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
||||||
{
|
{
|
||||||
int snum = ReadWord (stream);
|
int snum = ReadWord (stream);
|
||||||
int argn = ReadByte (stream);
|
int argn = ReadByte (stream);
|
||||||
int arg[3] = { 0, 0, 0 };
|
|
||||||
|
RunScript(stream, players[player].mo, snum, argn, type == DEM_RUNSCRIPT2);
|
||||||
for (i = 0; i < argn; ++i)
|
}
|
||||||
{
|
break;
|
||||||
int argval = ReadLong(stream);
|
|
||||||
if ((unsigned)i < countof(arg))
|
case DEM_RUNNAMEDSCRIPT:
|
||||||
{
|
{
|
||||||
arg[i] = argval;
|
char *sname = ReadString(stream);
|
||||||
}
|
int argn = ReadByte(stream);
|
||||||
}
|
|
||||||
P_StartScript (players[player].mo, NULL, snum, level.mapname, false,
|
RunScript(stream, players[player].mo, -FName(sname), argn & 127, !!(argn & 128));
|
||||||
arg[0], arg[1], arg[2], type == DEM_RUNSCRIPT2, false, true);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2471,6 +2471,24 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
||||||
delete[] s;
|
delete[] s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used by DEM_RUNSCRIPT, DEM_RUNSCRIPT2, and DEM_RUNNAMEDSCRIPT
|
||||||
|
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, bool always)
|
||||||
|
{
|
||||||
|
int arg[3] = { 0, 0, 0 };
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < argn; ++i)
|
||||||
|
{
|
||||||
|
int argval = ReadLong(stream);
|
||||||
|
if ((unsigned)i < countof(arg))
|
||||||
|
{
|
||||||
|
arg[i] = argval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
P_StartScript (pawn, NULL, snum, level.mapname, false,
|
||||||
|
arg[0], arg[1], arg[2], always, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
void Net_SkipCommand (int type, BYTE **stream)
|
void Net_SkipCommand (int type, BYTE **stream)
|
||||||
{
|
{
|
||||||
BYTE t;
|
BYTE t;
|
||||||
|
@ -2559,6 +2577,11 @@ void Net_SkipCommand (int type, BYTE **stream)
|
||||||
skip = 3 + *(*stream + 2) * 4;
|
skip = 3 + *(*stream + 2) * 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DEM_RUNNAMEDSCRIPT:
|
||||||
|
skip = strlen((char *)(*stream)) + 2;
|
||||||
|
skip += ((*(*stream + skip - 1)) & 127) * 4;
|
||||||
|
break;
|
||||||
|
|
||||||
case DEM_RUNSPECIAL:
|
case DEM_RUNSPECIAL:
|
||||||
skip = 2 + *(*stream + 1) * 4;
|
skip = 2 + *(*stream + 1) * 4;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -161,6 +161,7 @@ enum EDemoCommand
|
||||||
DEM_RUNSPECIAL, // 62 Byte: Special number, Byte: Arg count, Ints: Args
|
DEM_RUNSPECIAL, // 62 Byte: Special number, Byte: Arg count, Ints: Args
|
||||||
DEM_SETPITCHLIMIT, // 63 Byte: Up limit, Byte: Down limit (in degrees)
|
DEM_SETPITCHLIMIT, // 63 Byte: Up limit, Byte: Down limit (in degrees)
|
||||||
DEM_ADVANCEINTER, // 64 Advance intermission screen state
|
DEM_ADVANCEINTER, // 64 Advance intermission screen state
|
||||||
|
DEM_RUNNAMEDSCRIPT, // 65 String: Script name, Byte: Arg count + Always flag; each arg is a 4-byte int
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
// The following are implemented by cht_DoCheat in m_cheat.cpp
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
// Version identifier for network games.
|
// Version identifier for network games.
|
||||||
// Bump it every time you do a release unless you're certain you
|
// Bump it every time you do a release unless you're certain you
|
||||||
// didn't change anything that will affect sync.
|
// didn't change anything that will affect sync.
|
||||||
#define NETGAMEVERSION 225
|
#define NETGAMEVERSION 226
|
||||||
|
|
||||||
// Version stored in the ini's [LastRun] section.
|
// Version stored in the ini's [LastRun] section.
|
||||||
// Bump it if you made some configuration change that you want to
|
// Bump it if you made some configuration change that you want to
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
// Protocol version used in demos.
|
// Protocol version used in demos.
|
||||||
// Bump it if you change existing DEM_ commands or add new ones.
|
// Bump it if you change existing DEM_ commands or add new ones.
|
||||||
// Otherwise, it should be safe to leave it alone.
|
// Otherwise, it should be safe to leave it alone.
|
||||||
#define DEMOGAMEVERSION 0x216
|
#define DEMOGAMEVERSION 0x217
|
||||||
|
|
||||||
// Minimum demo version we can play.
|
// Minimum demo version we can play.
|
||||||
// Bump it whenever you change or remove existing DEM_ commands.
|
// Bump it whenever you change or remove existing DEM_ commands.
|
||||||
|
|
Loading…
Reference in a new issue