Merge branch 'fix-objectplace-silent' into 'next'

Fix objectplace -silent

See merge request STJr/SRB2!1214
This commit is contained in:
James R 2020-11-01 22:52:46 -05:00
commit f4b82f27db

View file

@ -1440,14 +1440,21 @@ void Command_Writethings_f(void)
void Command_ObjectPlace_f(void) void Command_ObjectPlace_f(void)
{ {
size_t thingarg;
size_t silent;
REQUIRE_INLEVEL; REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER; REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE; REQUIRE_NOULTIMATE;
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer);
silent = COM_CheckParm("-silent");
thingarg = 2 - ( silent != 1 );
// Entering objectplace? // Entering objectplace?
if (!objectplacing || COM_Argc() > 1) if (!objectplacing || thingarg < COM_Argc())
{ {
if (!objectplacing) if (!objectplacing)
{ {
@ -1456,7 +1463,7 @@ void Command_ObjectPlace_f(void)
if (players[0].powers[pw_carry] == CR_NIGHTSMODE) if (players[0].powers[pw_carry] == CR_NIGHTSMODE)
return; return;
if (!COM_CheckParm("-silent")) if (! silent)
{ {
HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE|V_AUTOFADEOUT); HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE|V_AUTOFADEOUT);
HU_SetCEchoDuration(10); HU_SetCEchoDuration(10);
@ -1507,9 +1514,9 @@ void Command_ObjectPlace_f(void)
op_oldstate = (statenum_t)(players[0].mo->state-states); op_oldstate = (statenum_t)(players[0].mo->state-states);
} }
if (COM_Argc() > 1) if (thingarg < COM_Argc())
{ {
UINT16 mapthingnum = atoi(COM_Argv(1)); UINT16 mapthingnum = atoi(COM_Argv(thingarg));
mobjtype_t type = P_GetMobjtype(mapthingnum); mobjtype_t type = P_GetMobjtype(mapthingnum);
if (type == MT_UNKNOWN) if (type == MT_UNKNOWN)
CONS_Printf(M_GetText("No mobj type delegated to thing type %d.\n"), mapthingnum); CONS_Printf(M_GetText("No mobj type delegated to thing type %d.\n"), mapthingnum);