- testing and cleanup of scripted morph code.
This commit is contained in:
parent
78d6832d14
commit
cce1bad042
10 changed files with 79 additions and 398 deletions
|
|
@ -90,10 +90,17 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
};
|
||||
PClassActor *type;
|
||||
AInventory *item;
|
||||
FString smsg;
|
||||
const char *msg = "";
|
||||
char msgbuild[32];
|
||||
int i;
|
||||
|
||||
// No cheating when not having a pawn attached.
|
||||
if (player->mo == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cheat)
|
||||
{
|
||||
case CHT_IDDQD:
|
||||
|
|
@ -188,7 +195,8 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
break;
|
||||
|
||||
case CHT_MORPH:
|
||||
msg = cht_Morph (player, PClass::FindActor (gameinfo.gametype == GAME_Heretic ? NAME_ChickenPlayer : NAME_PigPlayer), true);
|
||||
smsg = cht_Morph (player, PClass::FindActor (gameinfo.gametype == GAME_Heretic ? NAME_ChickenPlayer : NAME_PigPlayer), true);
|
||||
msg = smsg.GetChars();
|
||||
break;
|
||||
|
||||
case CHT_NOTARGET:
|
||||
|
|
@ -546,32 +554,17 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
Printf ("%s cheats: %s\n", player->userinfo.GetName(), msg);
|
||||
}
|
||||
|
||||
const char *cht_Morph (player_t *player, PClassActor *morphclass, bool quickundo)
|
||||
FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo)
|
||||
{
|
||||
if (player->mo == NULL)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
auto oldclass = player->mo->GetClass();
|
||||
if (player->mo == nullptr) return "";
|
||||
|
||||
// Set the standard morph style for the current game
|
||||
int style = MORPH_UNDOBYTOMEOFPOWER;
|
||||
if (gameinfo.gametype == GAME_Hexen) style |= MORPH_UNDOBYCHAOSDEVICE;
|
||||
|
||||
if (player->morphTics)
|
||||
IFVIRTUALPTR(player->mo, APlayerPawn, CheatMorph)
|
||||
{
|
||||
if (P_UndoPlayerMorph (player, player))
|
||||
{
|
||||
if (!quickundo && oldclass != morphclass && P_MorphPlayer (player, player, morphclass, 0, style))
|
||||
{
|
||||
return GStrings("TXT_STRANGER");
|
||||
}
|
||||
return GStrings("TXT_NOTSTRANGE");
|
||||
}
|
||||
}
|
||||
else if (P_MorphPlayer (player, player, morphclass, 0, style))
|
||||
{
|
||||
return GStrings("TXT_STRANGE");
|
||||
FString message;
|
||||
VMReturn msgret(&message);
|
||||
VMValue params[3] = { player->mo, morphclass, quickundo };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
return message;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
@ -602,8 +595,6 @@ void cht_SetInv(player_t *player, const char *string, int amount, bool beyond)
|
|||
|
||||
void cht_Give (player_t *player, const char *name, int amount)
|
||||
{
|
||||
if (player->mo == nullptr) return;
|
||||
|
||||
IFVIRTUALPTR(player->mo, APlayerPawn, CheatGive)
|
||||
{
|
||||
FString namestr = name;
|
||||
|
|
@ -614,8 +605,6 @@ void cht_Give (player_t *player, const char *name, int amount)
|
|||
|
||||
void cht_Take (player_t *player, const char *name, int amount)
|
||||
{
|
||||
if (player->mo == nullptr) return;
|
||||
|
||||
IFVIRTUALPTR(player->mo, APlayerPawn, CheatTake)
|
||||
{
|
||||
FString namestr = name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue