- Update to latest version in trunk.
SVN r3890 (scripting)
This commit is contained in:
commit
e7efa1d802
117 changed files with 2260 additions and 787 deletions
|
|
@ -45,6 +45,7 @@
|
|||
#include "d_net.h"
|
||||
#include "d_dehacked.h"
|
||||
#include "gi.h"
|
||||
#include "farchive.h"
|
||||
|
||||
// [RH] Actually handle the cheat. The cheat code in st_stuff.c now just
|
||||
// writes some bytes to the network data stream, and the network code
|
||||
|
|
@ -106,6 +107,20 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
msg = GStrings("STSTR_NCOFF");
|
||||
break;
|
||||
|
||||
case CHT_NOCLIP2:
|
||||
player->cheats ^= CF_NOCLIP2;
|
||||
if (player->cheats & CF_NOCLIP2)
|
||||
{
|
||||
player->cheats |= CF_NOCLIP;
|
||||
msg = GStrings("STSTR_NC2ON");
|
||||
}
|
||||
else
|
||||
{
|
||||
player->cheats &= ~CF_NOCLIP;
|
||||
msg = GStrings("STSTR_NCOFF");
|
||||
}
|
||||
break;
|
||||
|
||||
case CHT_NOVELOCITY:
|
||||
player->cheats ^= CF_NOVELOCITY;
|
||||
if (player->cheats & CF_NOVELOCITY)
|
||||
|
|
@ -504,8 +519,8 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
|
||||
if (player == &players[consoleplayer])
|
||||
Printf ("%s\n", msg);
|
||||
else
|
||||
Printf ("%s is a cheater: %s\n", player->userinfo.netname, msg);
|
||||
else if (cheat != CHT_CHASECAM)
|
||||
Printf ("%s cheats: %s\n", player->userinfo.netname, msg);
|
||||
}
|
||||
|
||||
const char *cht_Morph (player_t *player, PClassPlayerPawn *morphclass, bool quickundo)
|
||||
|
|
@ -1042,21 +1057,53 @@ void cht_Take (player_t *player, const char *name, int amount)
|
|||
return;
|
||||
}
|
||||
|
||||
class DSuicider : public DThinker
|
||||
{
|
||||
DECLARE_CLASS(DSuicider, DThinker)
|
||||
HAS_OBJECT_POINTERS;
|
||||
public:
|
||||
TObjPtr<APlayerPawn> Pawn;
|
||||
|
||||
void Tick()
|
||||
{
|
||||
Pawn->flags |= MF_SHOOTABLE;
|
||||
Pawn->flags2 &= ~MF2_INVULNERABLE;
|
||||
// Store the player's current damage factor, to restore it later.
|
||||
fixed_t plyrdmgfact = Pawn->DamageFactor;
|
||||
Pawn->DamageFactor = 65536;
|
||||
P_DamageMobj (Pawn, Pawn, Pawn, TELEFRAG_DAMAGE, NAME_Suicide);
|
||||
Pawn->DamageFactor = plyrdmgfact;
|
||||
if (Pawn->health <= 0)
|
||||
{
|
||||
Pawn->flags &= ~MF_SHOOTABLE;
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
// You'll probably never be able to catch this in a save game, but
|
||||
// just in case, add a proper serializer.
|
||||
void Serialize(FArchive &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
arc << Pawn;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_POINTY_CLASS(DSuicider)
|
||||
DECLARE_POINTER(Pawn)
|
||||
END_POINTERS
|
||||
|
||||
void cht_Suicide (player_t *plyr)
|
||||
{
|
||||
// If this cheat was initiated by the suicide ccmd, and this is a single
|
||||
// player game, the CHT_SUICIDE will be processed before the tic is run,
|
||||
// so the console has not gone up yet. Use a temporary thinker to delay
|
||||
// the suicide until the game ticks so that death noises can be heard on
|
||||
// the initial tick.
|
||||
if (plyr->mo != NULL)
|
||||
{
|
||||
plyr->mo->flags |= MF_SHOOTABLE;
|
||||
plyr->mo->flags2 &= ~MF2_INVULNERABLE;
|
||||
//Store the players current damage factor, to restore it later.
|
||||
fixed_t plyrdmgfact = plyr->mo->DamageFactor;
|
||||
plyr->mo->DamageFactor = 65536;
|
||||
P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, TELEFRAG_DAMAGE, NAME_Suicide);
|
||||
plyr->mo->DamageFactor = plyrdmgfact;
|
||||
if (plyr->mo->health <= 0)
|
||||
{
|
||||
plyr->mo->flags &= ~MF_SHOOTABLE;
|
||||
}
|
||||
DSuicider *suicide = new DSuicider;
|
||||
suicide->Pawn = plyr->mo;
|
||||
GC::WriteBarrier(suicide, suicide->Pawn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue